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