cfl_registry.h
Go to the documentation of this file.
1 /** @file cfl_registry.h Runtime interface, registry for faudes-types and functions */
2 
3 /* FAU Discrete Event Systems Library (libfaudes)
4 
5 Copyright (C) 2009 Ruediger Berndt
6 Copyright (C) 2009 Thomas Moor
7 
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12 
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17 
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
21 
22 
23 #ifndef FAUDES_RTIREGISTRY_H
24 #define FAUDES_RTIREGISTRY_H
25 
26 #include "cfl_types.h"
27 #include "cfl_functions.h"
28 
29 namespace faudes{
30 
31 
32 /**
33  * The TypeRegistry registers faudes-types. A faudes-type may be
34  * any class derived from faudes::Type, e.g. EventSet and generator.
35  * The registry maintains a mapping from faudes-type names to registred
36  * faudes::TypeDefinition. It provides an interface to inspect
37  * TypeDefinitions or to construct faudes-type objects by their type name.
38  *
39  * Technical note: the class is implemented according to the \"Singleton\" design
40  * pattern, ie, only one global instance of the registry can exist.
41  *
42  *
43  * @ingroup RunTimeInterface
44  */
45 
46 
47 class FAUDES_API TypeRegistry : public Type {
48 
49 public:
50 
51  using Type::operator=;
52 
53  /** Convenience typedef to access registry entries */
54  typedef std::map<std::string, TypeDefinition*>::const_iterator Iterator;
55 
56  /**
57  * Method to access the single global instance of the registry.
58  */
59  static TypeRegistry* G();
60 
61  /**
62  * Clear all registered type definitions. This will also delete the
63  * correponsing prototype objects. It will, however, not delete
64  * C++-autoregistered registry entries.
65  */
66  void Clear();
67 
68  /**
69  * Clear all registered type definitions. This will also delete the
70  * correponsing prototype objects. This version will also
71  * delete C++-autoregistered registry entries.
72  */
73  void ClearAll();
74 
75  /**
76  * Return number of registered type definitions.
77  *
78  * @return
79  * Size of map.
80  */
81  int Size() const;
82 
83  /**
84  * Test existence of a faudes-type by its name.
85  *
86  * @param rName
87  * Name of type to look up
88  *
89  * @return
90  * True, if a corresponding definition is registered.
91  */
92  bool Exists(const std::string& rName) const;
93 
94  /**
95  * Test existence of a faudes-type by faudes object
96  *
97  * @param rType
98  * Object of type to look up
99  *
100  * @return
101  * True, if a corresponding definition is registered.
102  */
103  bool Exists(const Type& rType) const;
104 
105  /**
106  * STL interator to the internal type-name map.
107  *
108  * @return
109  * Iterator to the first element.
110  */
111  Iterator Begin(void) const;
112 
113  /**
114  * STL interator to the internal type-name map.
115  *
116  * @return
117  * Iterator to the end of the map.
118  */
119  Iterator End(void) const;
120 
121  /**
122  * Add another type definition to the registry.
123  *
124  * The registry takes the ownership pf the provided
125  * type definition. It will be deleted either in Clear() or
126  * when the registry is destructed. The insertion of an allready registered
127  * type is ignored as long as the ctype matches. If the ctype
128  * fails to match, an exception is thrown.
129  *
130  * @param pTypeDef
131  * Type definition to insert
132  *
133  * @exception Exception
134  * - Identical name found (id 46)
135  */
136  void Insert(TypeDefinition* pTypeDef);
137 
138  /**
139  * Register a faudes-type with specified type name.
140  *
141  * This is a convenience function: it uses the template parameter to
142  * construct the new instance of TypeDefinition to be registered. However,
143  * no documentation is added. See also MergeDocumentation.
144  *
145  * @tparam T
146  * Template parameter to specify c++ type to register
147  * @param rTypeName
148  * Specify the faudes-type name
149  * @exception Exception
150  * - Identical name found (id 46)
151  */
152  template<class T>
153  void Insert(const std::string& rTypeName="") {
154  FD_DRTI("TypeRegistry::Insert<" << typeid(T).name() << ">(" << rTypeName << ")");
155  TypeDefinition* td = TypeDefinition::Constructor<T>(rTypeName);
156  Insert(td);
157  }
158 
159  /**
160  * Register a faudes-type with specified type name.
161  *
162  * This is a convenience function: it uses the specified object as a
163  * a prototype and registers it under the given name. The registry takes
164  * ownership of the prototype. However,
165  * no documentation is added. See also MergeDocumentation.
166  *
167  * @param pProto
168  * Prototype object
169  * @param rTypeName
170  * Specify the faudes-type name
171  * @exception Exception
172  * - Identical name found (id 46)
173  */
174  void Insert(Type* pProto, const std::string& rTypeName) {
175  FD_DRTI("TypeRegistry::Insert(prototype, " << rTypeName << ")");
176  TypeDefinition* td = TypeDefinition::Constructor(pProto, rTypeName);
177  Insert(td);
178  }
179 
180  /**
181  * Scan token input for type documentation.
182  * This function scans the entire token stream for sections
183  * with label "TypeDefinition". Any such section that refers to a type name
184  * which is known to the registry, will be applied to the corresponding
185  * registry entry. Typical invokation is as follows
186  *
187  * @code
188  * TypeRegistry::G()->Insert<EventSet>("EventSet");
189  * TypeRegistry::G()->Insert<Generator>("Generator");
190  * TypeRegistry::G()->MergeDocumentation("alldocufile.rti");
191  * @endcode
192  *
193  * @param rTr
194  * Token stream.
195  * @exception Exception
196  * - Token mismatch (id 50, 51, 52)
197  * - IO Error (id 1)
198  */
199  void MergeDocumentation(TokenReader& rTr);
200 
201  /**
202  * Scan file for type documentation.
203  * Convenience method, see also MergeDocumentation(TokenReader& rTr)
204  *
205  * @param rFileName
206  * Name of file to scan.
207  * @exception Exception
208  * - Token mismatch (id 50, 51, 52)
209  * - IO Error (id 1)
210  */
211  void MergeDocumentation(const std::string& rFileName);
212 
213 
214  /**
215  * Set element type for given faudes-type.
216  *
217  * For sets and vectors, the elment tpye is used
218  * to factory elments for token IO.
219  * Unregistered types are silently ignored.
220  *
221  * @param rTypeName
222  * Name of faudes-type
223  * @param rElementTat
224  * New value of element type
225  */
226  void ElementType(const std::string& rTypeName, const std::string& rElementType);
227 
228  /**
229  * Get element type for given faudes-type.
230  *
231  * For sets and vectors, the elment type is used
232  * to factory elments for token IO
233  * Unregistered types are silently ignored.
234  *
235  * @param rTypeName
236  * Name of faudes-type
237  * @return
238  * Xml element tag
239  */
240  const std::string& ElementType(const std::string& rTypeName) const;
241 
242  /**
243  * Set element tag for given faudes-type.
244  *
245  * Access to the ElementTag of a type definition. The latter is
246  * used for Xml token IO of sets and vectors.
247  * Unregistered types are silently ignored.
248  *
249  * @param rTypeName
250  * Name of faudes-type
251  * @param rTag
252  * New value of tag
253  */
254  void ElementTag(const std::string& rTypeName, const std::string& rTag);
255 
256  /**
257  * Get lement tag for given faudes-type.
258  *
259  * Access to the ElementTag of a type definition. The latter is
260  * used for Xml token IO of sets and vectors.
261  * Unregistered types return the empty string.
262  *
263  * @param rTypeName
264  * Name of faudes-type
265  * @return
266  * Xml element tag
267  */
268  const std::string& ElementTag(const std::string& rTypeName) const;
269 
270  /**
271  * Get AutoRegister flag for given faudes-type.
272  *
273  * Access the AutoRegister flag of a type definition.
274  * The flag is true for entries which were instantiated
275  * automatically by static constructor objects. AutoRegistered flags
276  * will not be cleared.
277  *
278  * @param rTypeName
279  * Name of faudes-type
280  * @return
281  * AutoRegister flag
282  */
283  bool AutoRegistered(const std::string& rTypeName) const;
284 
285  /**
286  * Set AutoRegistered flag for given faudes-type.
287  *
288  * Access the AutoRegister flag of a type definition.
289  * The flag is true for entries with were instantiated by
290  * automatically by static constructor objects. AutoRegistered flags
291  * will not be cleared.
292  *
293  * @param rTypeName
294  * Name of faudes-type
295  * @param flag
296  * New value of flag
297  */
298  void AutoRegistered(const std::string& rTypeName, bool flag);
299 
300  /**
301  * Construct a faudes object by type name
302  *
303  * Uses the internal prototype object to construct
304  * an object of the same c type on the heap.
305  *
306  * @param rTypeName
307  * Label of TypeDefinition to search for.
308  * @return
309  * Pointer to new faudes::Type instance
310  * @exception Exception
311  * - Unknown type (id 47)
312  */
313  Type* NewObject(const std::string& rTypeName) const;
314 
315  /**
316  * Construct a faudes object by prototype object.
317  *
318  * Depreciated: use new on the faudes object instead.
319  *
320  * @param rType
321  * Prototype object.
322  *
323  * @return
324  * Pointer to new faudes::Type instance
325  * @exception Exception
326  * - Unknown type (id 47)
327  */
328  Type* NewObject(const Type& rType) const;
329 
330 
331  /**
332  * Look up the type definition by faudes-type name
333  *
334  * @param rTypeName
335  * Faudes-tyep name to search for.
336  *
337  * @return
338  * Reference to faudes::TypeDefinition
339  *
340  * @exception Exception
341  * - Unknown type (id 46)
342  */
343  const TypeDefinition& Definition(const std::string& rTypeName) const;
344 
345  /**
346  * Look up the type definition by faudes object
347  *
348  * @param rType
349  * Reference to faudes::Type to search for.
350  *
351  * @return
352  * Reference to faudes::TypeDefinition
353  *
354  * @exception Exception
355  * - Unknown type (id 46)
356  */
357  const TypeDefinition& Definition(const Type& rType) const;
358 
359  /**
360  * Look up the type definition by faudes-type name
361  *
362  * @param rTypeName
363  * Faudes-tyep name to search for.
364  *
365  * @return
366  * Pointer to faudes::TypeDefinition, NULL for unknown type.
367  *
368  */
369  const TypeDefinition* Definitionp(const std::string& rTypeName) const;
370 
371  /**
372  * Look up the type definition by faudes object
373  *
374  * @param rType
375  * Reference to faudes::Type to search for.
376  *
377  * @return
378  * Pointer to faudes::TypeDefinition, NULL for unknoen type.
379  *
380  */
381  const TypeDefinition* Definitionp(const Type& rType) const;
382 
383 
384  /**
385  * Look up the prototype object by faudes-type name
386  *
387  * @param rTypeName
388  * Label of faudes::TypeDefinition to search for.
389  *
390  * @return
391  * Reference to faudes::Type object, Null for unknown type
392  *
393  */
394  const Type* Prototype(const std::string& rTypeName) const;
395 
396  /**
397  * Look up the type name by faudes object
398  *
399  * @param rType
400  * Reference to faudes::Type to search for.
401  *
402  * @return
403  * Type name as string or "" if unknown.
404  *
405  */
406  const std::string& TypeName(const Type& rType) const;
407 
408  /**
409  * Cosmetic: fix compile warning for recent LLVM/clang++
410  */
411  using Type::TypeName;
412 
413  /**
414  * Test type compatibility.
415  * Test whether the provided object
416  * can be casted to the specified type name,
417  *
418  * @param rTypeName
419  * Faudes type name
420  * @param rObject
421  * Faudes object instance
422  * @return
423  * True, if object can be casted to specified faudes type.
424  *
425  */
426  bool TypeTest(const std::string& rTypeName, const Type& rObject) const;
427 
428 
429  protected:
430 
431  /**
432  * Write registry data of this to TokenWriter.
433  *
434  * Since the registry cannot reconfigure itself from a token stream,
435  * this output is informative only. However, MergeDocumentation will
436  * accept the format to extract documentation.
437  *
438  * @param rTw
439  * Reference to TokenWriter
440  * @param rLabel
441  * Label of section to write
442  * @param pContext
443  * Write context to provide contextual information
444  *
445  * @exception Exception
446  * - IO errors (id 2)
447  */
448  virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="",const Type* pContext=0) const;
449 
450  /** Convenience typedef to access registry entries */
451  typedef std::map<std::string, TypeDefinition*>::iterator iterator;
452 
453  /** Singleton instance */
455 
456  /** Constructor */
458 
459  /** Destructor */
460  virtual ~TypeRegistry(){
461  Clear();
462  }
463 
464  /** Map to associate labels and faudes::TypeDefinitions. */
465  std::map<std::string, TypeDefinition*> mNameToTypeDef;
466  std::map<std::string, TypeDefinition*> mIdToTypeDef;
467 
468 }; // TypeRegistry
469 
470 
471 /**
472  * Auto register faudes-type with specified type name.
473  *
474  * This is a convenience class template to automize faudes type registration.
475  * It uses the Insert template of the type registry. If the type name
476  * is already registered, no registration will take place and the old
477  * configuration is maintained. Also registration with faudes-type name "Void"
478  * will be silently ignored.
479  * Type documentation is not supported but may
480  * be added via MergeDocumentation.
481  *
482  * @tparam T
483  * Template parameter to specify the C++ type to register
484  * @param rTypeName
485  * Specify the faudes-type name
486  */
487 template<class T>
489  public:
490  AutoRegisterType(const std::string& rTypeName="Void") {
491  if(rTypeName=="Void") return;
492  if(TypeRegistry::G()->Exists(rTypeName)) return;
493  FD_DREG("AutoRegisterType(" << rTypeName << "): by prototype template with " << typeid(T).name());
494  TypeRegistry::G()->Insert<T>(rTypeName);
495  TypeRegistry::G()->AutoRegistered(rTypeName,true);
496  };
497 };
498 
499 template<class T>
501  public:
502  AutoRegisterElementTag(const std::string& rTypeName, const std::string& rTag) {
503  static AutoRegisterType<T> srego(rTypeName);
504  TypeRegistry::G()->ElementTag(rTypeName,rTag);
505  };
506 };
507 
508 template<class T>
510  public:
511  AutoRegisterElementType(const std::string& rTypeName, const std::string& rTag) {
512  static AutoRegisterType<T> srego(rTypeName);
513  TypeRegistry::G()->ElementType(rTypeName,rTag);
514  };
515 };
516 
517 
518 
519 /**
520  * The FunctionRegistry registers faudes-functions. A faudes-functions
521  * operates on faudes objects, eg the parallel composition of two
522  * generators is available as faudes-function. The registry maintains a
523  * mapping between function names and a coresponding function::Definition.
524  * The latter provides signatures, ie parameter types the function can
525  * take. The registry provides an interface to inspect
526  * TypeDefinitions or to construct function objects by their type name.
527  *
528  * Technical note: the class is implemented according to the \"Singleton\" design
529  * pattern, ie, only one global instance of the registry can exist.
530  *
531  * @ingroup RunTimeInterface
532  */
533 
535 
536 public:
537 
538  using Type::operator=;
539 
540  /** Convenience typedef to access registry entries */
541  typedef std::map<std::string, FunctionDefinition*>::const_iterator Iterator;
542 
543  /**
544  * Method to access the single global instance of the registry.
545  */
546  static FunctionRegistry* G();
547 
548  /**
549  * Clear all registered function definitions. This will also delete the
550  * correponsing prototype objects.
551  */
552  void Clear();
553 
554  /**
555  * Return number of registered function definitions.
556  *
557  * @return
558  * Size of map.
559  */
560  int Size() const;
561 
562  /**
563  * Test existence of a faudes-function by its name.
564  *
565  * @param rName
566  * Name of function to look up
567  *
568  * @return
569  * True, if a corresponding definition is registered.
570  */
571  bool Exists(const std::string& rName) const;
572 
573  /**
574  * Test existence of a faudes-function by faudes object
575  *
576  * @param rFunction
577  * Object of function to look up
578  *
579  * @return
580  * True, if a corresponding definition is registered.
581  */
582  bool Exists(const Function& rFunction) const;
583 
584  /**
585  * STL interator to the internal function-name map.
586  *
587  * @return
588  * Iterator to the first element.
589  */
590  Iterator Begin(void) const;
591 
592  /**
593  * STL interator to the internal function-name map.
594  *
595  * @return
596  * Iterator to the end of the map.
597  */
598  Iterator End(void) const;
599 
600  /**
601  * Add another function definition to the registry.
602  *
603  * The registry takes the ownership pf the provided
604  * function definition. It will be deleted either in Clear() or
605  * when the registry is destructed.
606  *
607  * @param pFunctionDef
608  * Function definition to insert
609  *
610  * @exception Exception
611  * - Identical name found (id 46)
612  */
613  void Insert(FunctionDefinition* pFunctionDef);
614 
615  /**
616  * Register a faudes-function with specified function name.
617  *
618  * This is a convenience function: it uses the template parameter to
619  * construct the new instance of FunctionDefinition to be registered. However,
620  * no documentation is added. See also MergeDocumentation.
621  *
622  * @tparam T
623  * Template parameter to specify c++ function to register
624  * @param rFunctionName
625  * Specify the faudes-function name
626  * @exception Exception
627  * - Identical name found (id 46)
628  */
629  template<class T>
630  void Insert(const std::string& rFunctionName="") {
631  FD_DRTI("FunctionRegistry::Insert<>(" << rFunctionName << ")");
632  FunctionDefinition* td = FunctionDefinition::Constructor<T>(rFunctionName);
633  Insert(td);
634  }
635 
636  /**
637  * Scan token input for function documentation.
638  * This function scans the entire token stream for sections
639  * with label "FunctionDefinition". Any such section that refers to a function name
640  * which is known to the registry, will be applied to the corresponding
641  * registry entry.
642  *
643  *
644  * @param rTr
645  * Token stream.
646  * @exception Exception
647  * - Token mismatch (id 50, 51, 52)
648  * - IO Error (id 1)
649  */
650  void MergeDocumentation(TokenReader& rTr);
651 
652  /**
653  * Scan file for function documentation.
654  * Convenience method, see also MergeDocumentation(TokenReader& rTr)
655  *
656  * @param rFileName
657  * Name of file to scan.
658  * @exception Exception
659  * - Token mismatch (id 50, 51, 52)
660  * - IO Error (id 1)
661  */
662  void MergeDocumentation(const std::string& rFileName);
663 
664  /**
665  * Construct a faudes object by function name
666  *
667  * Uses the internal prototype object to construct
668  * an object of the same c function on the heap.
669  *
670  * @param rFunctionName
671  * Label of FunctionDefinition to search for.
672  * @return
673  * Pointer to new faudes::Function instance
674  * @exception Exception
675  * - Unknown function (id 47)
676  */
677  Function* NewFunction(const std::string& rFunctionName) const;
678 
679  /**
680  * Construct a faudes object by protofunction object.
681  *
682  * Depreciated: use new on the faudes object instead.
683  *
684  * @param rFunction
685  * Protofunction object.
686  *
687  * @return
688  * Pointer to new faudes::Function instance
689  * @exception Exception
690  * - Unknown function (id 47)
691  */
692  Function* NewFunction(const Function& rFunction) const;
693 
694 
695  /**
696  * Look up the function definition by faudes-function name
697  *
698  * @param rFunctionName
699  * Label of faudes::FunctionDefinition to search for.
700  *
701  * @return
702  * Reference to faudes::FunctionDefinition
703  *
704  * @exception Exception
705  * - Unknown function (id 46)
706  */
707  const FunctionDefinition& Definition(const std::string& rFunctionName) const;
708 
709  /**
710  * Look up the function definition by faudes object
711  *
712  * Techcal note: this implementation is slow, we should
713  * use a function id map.
714  *
715  * @param rFunction
716  * Reference to faudes::Function to search for.
717  *
718  * @return
719  * Reference to faudes::FunctionDefinition
720  *
721  * @exception Exception
722  * - Unknown function (id 46)
723  */
724  const FunctionDefinition& Definition(const Function& rFunction) const;
725 
726  /**
727  * Look up the function definition by faudes-function name
728  *
729  * @param rFunctionName
730  * Label of faudes::FunctionDefinition to search for.
731  *
732  * @return
733  * Reference to faudes::FunctionDefinition
734  *
735  * @return
736  * Pointer to faudes::FunctionDefinition, NULL for unknown type.
737  *
738  */
739  const FunctionDefinition* Definitionp(const std::string& rTypeName) const;
740 
741  /**
742  * Look up the function name by faudes object
743  *
744  * @param rFunction
745  * Reference to faudes::Function to search for.
746  *
747  * @return
748  * Function name as string or "" if unknown.
749  *
750  */
751  const std::string& FunctionName(const Function& rFunction) const;
752 
753  protected:
754 
755  /**
756  * Write registry data of this to TokenWriter.
757  *
758  * Since the registry cannot reconfigure itself from a token stream,
759  * this output is informative only. However, MergeDocumentation will
760  * accept the format to insert/extract documentation.
761  *
762  * @param rTw
763  * Reference to TokenWriter
764  * @param rLabel
765  * Label of section to write
766  * @param pContext
767  * Write context to provide contextual information
768  *
769  * @exception Exception
770  * - IO errors (id 2)
771  */
772  virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="",const Type* pContext=0) const;
773 
774  /** Convenience typedef to access registry entries */
775  typedef std::map<std::string, FunctionDefinition*>::iterator iterator;
776 
777  /** Singleton instance */
779 
780  /** Constructor */
782 
783  /** Destructor */
784  virtual ~FunctionRegistry(){
785  Clear();
786  }
787 
788  /** Map to associate labels and faudes::FunctionDefinitions. */
789  std::map<std::string, FunctionDefinition*> mNameToFunctionDef;
790  std::map<std::string, FunctionDefinition*> mIdToFunctionDef;
791 
792 }; // FunctionRegistry
793 
794 
795 /**
796  * Load all registered types and functions.
797  *
798  * The default file is some not so educated guess, so you
799  * should specify it explicitely.
800  *
801  * @param rPath
802  * Source file
803  *
804  * @ingroup RunTimeInterface
805  */
806 
807 extern FAUDES_API void LoadRegistry(const std::string& rPath="");
808 
809 
810 /**
811  * Dump all registered types and functions
812  *
813  * The destinations defaults to stdout.
814  *
815  * @param rPath
816  * Destination file
817  *
818  * @ingroup RunTimeInterface
819  */
820 
821 extern FAUDES_API void SaveRegistry(const std::string& rPath="");
822 
823 
824 /**
825  * Clear all registry
826  *
827  * @ingroup RunTimeInterface
828  */
829 
830 extern FAUDES_API void ClearRegistry(void);
831 
832 
833 /**
834  * Instantiate faudes typed objects by type name.
835  * Convenience function to access registry singleton.
836  *
837  * @param rTypeName
838  * Type to instantiate
839  *
840  * @ingroup RunTimeInterface
841  */
842 
843 extern FAUDES_API Type* NewFaudesObject(const std::string& rTypeName);
844 
845 /**
846  * Query type name.
847  * Convenience function to access registry singleton.
848  *
849  * @param rObject
850  * Faudes object instance
851  * @return
852  * Faudes type name or "" if unkown.
853  *
854  * @ingroup RunTimeInterface
855  */
856 
857 extern FAUDES_API const std::string& FaudesTypeName(const Type& rObject);
858 
859 
860 /**
861  * Test type compatibility.
862  * Convenience function to access registry singleton.
863  *
864  * @param rTypeName
865  * Faudes type name
866  * @param rObject
867  * Faudes object instance
868  * @return
869  * True, if object can be casted to specified faudes type.
870  *
871  * @ingroup RunTimeInterface
872  */
873 extern FAUDES_API bool FaudesTypeTest(const std::string& rTypeName, const Type& rObject);
874 
875 
876 /**
877  * Instantiate faudes function objects by function name.
878  * Convenience function to access registry singleton.
879  *
880  * @param rFunctName
881  * Function to instantiate
882  *
883  * @ingroup RunTimeInterface
884  */
885 extern FAUDES_API Function* NewFaudesFunction(const std::string& rFunctName);
886 
887 /**
888  * Query function name.
889  * Convenience function to access registry singleton.
890  *
891  * @param rObject
892  * Faudes object instance
893  * @return
894  * Faudes function name or "" if unkown.
895  *
896  * @ingroup RunTimeInterface
897  */
898 extern FAUDES_API const std::string& FaudesFunctionName(const Type& rObject);
899 
900 
901 
902 /**********************************************************************************************
903 ***********************************************************************************************
904 ***********************************************************************************************
905 
906 Implemention of template members functions
907 
908 ***********************************************************************************************
909 ***********************************************************************************************
910 **********************************************************************************************/
911 
912 
913 
914 
915 
916 } // namespace
917 
918 #endif /* FAUDES_RTIREGISTRY_H */
#define FD_DREG(message)
#define FD_DRTI(message)
#define FAUDES_API
Definition: cfl_platform.h:80
AutoRegisterElementTag(const std::string &rTypeName, const std::string &rTag)
Definition: cfl_registry.h:502
AutoRegisterElementType(const std::string &rTypeName, const std::string &rTag)
Definition: cfl_registry.h:511
AutoRegisterType(const std::string &rTypeName="Void")
Definition: cfl_registry.h:490
void Insert(const std::string &rFunctionName="")
Definition: cfl_registry.h:630
std::map< std::string, FunctionDefinition * >::const_iterator Iterator
Definition: cfl_registry.h:541
static FunctionRegistry * mpInstance
Definition: cfl_registry.h:778
std::map< std::string, FunctionDefinition * >::iterator iterator
Definition: cfl_registry.h:775
std::map< std::string, FunctionDefinition * > mNameToFunctionDef
Definition: cfl_registry.h:789
std::map< std::string, FunctionDefinition * > mIdToFunctionDef
Definition: cfl_registry.h:790
static TypeDefinition * Constructor(const std::string &rTypeName="")
Definition: cfl_types.h:1881
void ElementTag(const std::string &rTypeName, const std::string &rTag)
void ElementType(const std::string &rTypeName, const std::string &rElementType)
std::map< std::string, TypeDefinition * > mIdToTypeDef
Definition: cfl_registry.h:466
static TypeRegistry * G()
static TypeRegistry * mpInstance
Definition: cfl_registry.h:454
void Insert(TypeDefinition *pTypeDef)
bool AutoRegistered(const std::string &rTypeName) const
std::map< std::string, TypeDefinition * >::iterator iterator
Definition: cfl_registry.h:451
void Insert(Type *pProto, const std::string &rTypeName)
Definition: cfl_registry.h:174
std::map< std::string, TypeDefinition * > mNameToTypeDef
Definition: cfl_registry.h:465
void Insert(const std::string &rTypeName="")
Definition: cfl_registry.h:153
std::map< std::string, TypeDefinition * >::const_iterator Iterator
Definition: cfl_registry.h:54
virtual const std::string & TypeName(void) const
Definition: cfl_types.cpp:138
bool FaudesTypeTest(const std::string &rTypeName, const Type &rObject)
Function * NewFaudesFunction(const std::string &rFunctName)
void ClearRegistry(void)
const std::string & FaudesTypeName(const Type &rObject)
void SaveRegistry(const std::string &rPath)
Type * NewFaudesObject(const std::string &rTypeName)
void LoadRegistry(const std::string &rPath)
const std::string & FaudesFunctionName(const Function &rObject)

libFAUDES 2.33h --- 2025.06.18 --- c++ api documentaion by doxygen