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

libFAUDES 2.32b --- 2024.03.01 --- c++ api documentaion by doxygen