cfl_registry.h

Go to the documentation of this file.
00001 /** @file cfl_registry.h Runtime interface, registry for faudes-types and functions */
00002 
00003 /* FAU Discrete Event Systems Library (libfaudes)
00004 
00005 Copyright (C) 2009 Ruediger Berndt
00006 Copyright (C) 2009 Thomas Moor
00007 
00008 This library is free software; you can redistribute it and/or
00009 modify it under the terms of the GNU Lesser General Public
00010 License as published by the Free Software Foundation; either
00011 version 2.1 of the License, or (at your option) any later version.
00012 
00013 This library is distributed in the hope that it will be useful,
00014 but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 Lesser General Public License for more details.
00017 
00018 You should have received a copy of the GNU Lesser General Public
00019 License along with this library; if not, write to the Free Software
00020 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00021 
00022 
00023 #ifndef FAUDES_RTIREGISTRY_H
00024 #define FAUDES_RTIREGISTRY_H
00025 
00026 #include "cfl_types.h"
00027 #include "cfl_functions.h"
00028  
00029 namespace faudes{
00030 
00031 
00032 /**
00033  * The TypeRegistry registers faudes-types. A faudes-type may be
00034  * any class derived from faudes::Type, e.g. EventSet and generator.
00035  * The registry maintains a mapping from faudes-type names to registred 
00036  * faudes::TypeDefinition. It provides an interface to inspect 
00037  * TypeDefinitions or to construct faudes-type objects by their type name. 
00038  *
00039  * Technical note: the class is implemented according to the \"Singleton\" design 
00040  * pattern, ie, only one global instance of the registry can exist.
00041  *
00042  *
00043  * @ingroup RunTimeInterface
00044  */
00045 
00046 
00047 class TypeRegistry : public Type {
00048 
00049 public:
00050 
00051   /** Convenience typedef to access registry entries */     
00052   typedef std::map<std::string, TypeDefinition*>::const_iterator Iterator;
00053 
00054   /**
00055    * Method to access the single global instance of the registry.
00056    */
00057   static TypeRegistry* G();
00058 
00059   /** 
00060    * Clear all registered type definitions. This will also delete the
00061    * correponsing prototype objects. It will, however, not delete
00062    * C++-autoregistered registry entries.
00063    */
00064   void Clear();
00065 
00066   /** 
00067    * Clear all registered type definitions. This will also delete the
00068    * correponsing prototype objects. This version will also
00069    * delete C++-autoregistered registry entries.
00070    */
00071   void ClearAll();
00072 
00073   /**
00074    * Return number of registered type definitions.
00075    *
00076    * @return
00077    *  Size of map.
00078    */
00079   int Size() const;
00080 
00081   /**
00082    * Test existence of a faudes-type by its name.
00083    *
00084    * @param rName
00085    *  Name of type to look up
00086    *
00087    * @return
00088    *  True, if a corresponding definition is registered.
00089    */
00090   bool Exists(const std::string& rName) const;
00091 
00092   /**
00093    * Test existence of a faudes-type by faudes object
00094    *
00095    * @param rType
00096    *  Object of type to look up
00097    *
00098    * @return
00099    *  True, if a corresponding definition is registered.
00100    */
00101   bool Exists(const Type& rType) const;
00102 
00103   /**
00104    * STL interator to the internal type-name map.
00105    *
00106    * @return
00107    *  Iterator to the first element.
00108    */
00109   Iterator Begin(void) const;
00110 
00111   /**
00112    * STL interator to the internal type-name map.
00113    *
00114    * @return
00115    *  Iterator to the end of the map.
00116    */
00117   Iterator End(void) const;
00118 
00119   /**
00120    * Add another type definition to the registry.
00121    *
00122    * The registry takes the ownership pf the provided
00123    * type definition. It will be deleted either in Clear() or 
00124    * when the registry is destructed. The insertion of an allready registered
00125    * type is ignored as long as the ctype matches. If the ctype
00126    * fails to match, an exception is thrown.
00127    *
00128    * @param pTypeDef
00129    *  Type definition to insert
00130    *
00131    * @exception Exception
00132    *  - Identical name found (id 46)
00133    */
00134   void Insert(TypeDefinition* pTypeDef);
00135 
00136   /**
00137    * Register a faudes-type with specified type name.
00138    *
00139    * This is a convenience function: it uses the template parameter to
00140    * construct the new instance of TypeDefinition to be registered. However,
00141    * no documentation is added. See also MergeDocumentation.
00142    *
00143    * @tparam T
00144    *   Template parameter to specify c++ type to register
00145    * @param rTypeName
00146    *   Specify the faudes-type name 
00147    * @exception Exception
00148    *  - Identical name found (id 46)
00149    */
00150   template<class T>
00151   void Insert(const std::string& rTypeName="") {
00152     FD_DRTI("TypeRegistry::Insert<" << typeid(T).name() << ">(" << rTypeName << ")");
00153     TypeDefinition* td = TypeDefinition::Constructor<T>(rTypeName);
00154     Insert(td);
00155   }
00156 
00157   /**
00158    * Register a faudes-type with specified type name.
00159    *
00160    * This is a convenience function: it uses the specified object as a
00161    * a prototype and registers it under the given name. The registry takes 
00162    * ownership of the prototype. However,
00163    * no documentation is added. See also MergeDocumentation.
00164    *
00165    * @param pProto
00166    *   Prototype object
00167    * @param rTypeName
00168    *   Specify the faudes-type name 
00169    * @exception Exception
00170    *  - Identical name found (id 46)
00171    */
00172   void Insert(Type* pProto, const std::string& rTypeName) {
00173     FD_DRTI("TypeRegistry::Insert(prototype, " << rTypeName << ")");
00174     TypeDefinition* td = TypeDefinition::Constructor(pProto, rTypeName);
00175     Insert(td);
00176   }
00177 
00178   /**
00179    * Scan token input for type documentation.
00180    * This function scans the entire token stream for sections
00181    * with label "TypeDefinition". Any such section that refers to a type name
00182    * which is known to the registry, will be applied to the corresponding 
00183    * registry entry. Typical invokation is as follows
00184    *
00185    * @code
00186    * TypeRegistry::G()->Insert<EventSet>("EventSet");
00187    * TypeRegistry::G()->Insert<Generator>("Generator");
00188    * TypeRegistry::G()->MergeDocumentation("alldocufile.rti");
00189    * @endcode
00190    *
00191    * @param rTr
00192    *  Token stream.
00193    * @exception Exception
00194    *  - Token mismatch (id 50, 51, 52)
00195    *  - IO Error (id 1)
00196    */
00197   void MergeDocumentation(TokenReader& rTr);
00198 
00199   /**
00200    * Scan file for type documentation.
00201    * Convenience method, see also MergeDocumentation(TokenReader& rTr)
00202    *
00203    * @param rFileName
00204    *  Name of file to scan.
00205    * @exception Exception
00206    *  - Token mismatch (id 50, 51, 52)
00207    *  - IO Error (id 1)
00208    */
00209   void MergeDocumentation(const std::string& rFileName);
00210 
00211 
00212   /**
00213    * Set Xml element tag for given faudes-type.
00214    *
00215    * Access to the XElementTag of a type definition. The latter is
00216    * used for Xml token IO of sets and vectors.
00217    * Unregistered types are silently ignored.
00218    *
00219    * @param rTypeName
00220    *  Name of faudes-type
00221    * @param rTag
00222    *    New value of tag
00223    */
00224   void XElementTag(const std::string& rTypeName, const std::string& rTag);
00225 
00226   /**
00227    * Get Xml element tag for given faudes-type.
00228    *
00229    * Access to the XElementTag of a type definition. The latter is
00230    * used for Xml token IO of sets and vectors.
00231    * Unregistered types return the empty string.
00232    *
00233    * @param rTypeName
00234    *  Name of faudes-type
00235    * @return
00236    *    Xml element tag
00237    */
00238   const std::string& XElementTag(const std::string& rTypeName) const;
00239 
00240   /**
00241    * Get AutoRegister flag for given faudes-type.
00242    *
00243    * Access the AutoRegister flag of a type definition. 
00244    * The flag is true for entries which were instantiated 
00245    * automatically by static constructor objects. AutoRegistered flags
00246    * will not be cleared.
00247    *
00248    * @param rTypeName
00249    *  Name of faudes-type
00250    * @return
00251    *    AutoRegister flag
00252    */
00253   bool AutoRegistered(const std::string& rTypeName) const;
00254 
00255   /**
00256    * Set AutoRegistered flag for given faudes-type.
00257    *
00258    * Access the AutoRegister flag of a type definition. 
00259    * The flag is true for entries with were instantiated by
00260    * automatically by static constructor objects. AutoRegistered flags
00261    * will not be cleared.
00262    *
00263    * @param rTypeName
00264    *  Name of faudes-type
00265    * @param flag
00266    *    New value of flag
00267    */
00268   void AutoRegistered(const std::string& rTypeName, bool flag);
00269 
00270   /**
00271    * Construct a faudes object by type name
00272    *
00273    * Uses the internal prototype object to construct
00274    * an object of the same c type on the heap. 
00275    *
00276    * @param rTypeName
00277    *  Label of TypeDefinition to search for.
00278    * @return
00279    *  Pointer to new faudes::Type instance 
00280    * @exception Exception
00281    *  - Unknown type (id 47)
00282    */
00283   Type* NewObject(const std::string& rTypeName) const;
00284 
00285   /**
00286    * Construct a faudes object by prototype object.
00287    *
00288    * Depreciated: use new on the faudes object instead.
00289    *
00290    * @param rType
00291    *  Prototype object.
00292    *
00293    * @return
00294    *  Pointer to new faudes::Type instance
00295    * @exception Exception
00296    *  - Unknown type (id 47)
00297    */
00298   Type* NewObject(const Type& rType) const;
00299 
00300 
00301   /**
00302    * Look up the type definition by faudes-type name
00303    *
00304    * @param rTypeName
00305    *  Faudes-tyep name to search for.
00306    *
00307    * @return
00308    *  Reference to faudes::TypeDefinition
00309    *
00310    * @exception Exception
00311    *  - Unknown type (id 46)
00312    */
00313   const TypeDefinition& Definition(const std::string& rTypeName) const;
00314 
00315   /**
00316    * Look up the type definition by faudes object
00317    *
00318    * @param rType
00319    *  Reference to faudes::Type to search for.
00320    *
00321    * @return
00322    *  Reference to faudes::TypeDefinition
00323    *
00324    * @exception Exception
00325    *  - Unknown type (id 46)
00326    */
00327   const TypeDefinition& Definition(const Type& rType) const;
00328 
00329   /**
00330    * Look up the type definition by faudes-type name
00331    *
00332    * @param rTypeName
00333    *  Faudes-tyep name to search for.
00334    *
00335    * @return
00336    *  Pointer to faudes::TypeDefinition, NULL for unknoen type.
00337    *
00338    */
00339   const TypeDefinition* Definitionp(const std::string& rTypeName) const;
00340 
00341   /**
00342    * Look up the type definition by faudes object
00343    *
00344    * @param rType
00345    *  Reference to faudes::Type to search for.
00346    *
00347    * @return
00348    *  Pointer to faudes::TypeDefinition, NULL for unknoen type.
00349    *
00350    */
00351   const TypeDefinition* Definitionp(const Type& rType) const;
00352 
00353 
00354   /**
00355    * Look up the prototype object by faudes-type name
00356    *
00357    * @param rTypeName
00358    *  Label of faudes::TypeDefinition to search for.
00359    *
00360    * @return
00361    *  Reference to faudes::Type object, Null for unknown type
00362    *
00363    */
00364   const Type* Prototype(const std::string& rTypeName) const;
00365 
00366   /**
00367    * Look up the type name by faudes object
00368    *
00369    * @param rType
00370    *  Reference to faudes::Type to search for.
00371    *
00372    * @return
00373    *  Type name as string or "" if unknown.
00374    *
00375    */
00376   const std::string& TypeName(const Type& rType) const;
00377 
00378   /** 
00379    * Test type compatibility.
00380    * Test whether the provided object
00381    * can be casted to the specified type name,
00382    * 
00383    * @param rTypeName
00384    *  Faudes type name
00385    * @param rObject
00386    *  Faudes object instance
00387    * @return
00388    *  True, if object can be casted to specified faudes type.
00389    *
00390    */
00391    bool TypeTest(const std::string& rTypeName, const Type& rObject) const;
00392 
00393 
00394  protected:
00395 
00396   /**
00397    * Write registry data of this to TokenWriter.
00398    *
00399    * Since the registry cannot reconfigure itself from a token stream,
00400    * this output is informative only. However, MergeDocumentation will 
00401    * accept the format to extract documentation.
00402    *
00403    * @param rTw
00404    *   Reference to TokenWriter
00405    * @param rLabel
00406    *   Label of section to write
00407    * @param pContext
00408    *   Write context to provide contextual information
00409    *
00410    * @exception Exception 
00411    *   - IO errors (id 2)
00412    */
00413   virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="",const Type* pContext=0) const;
00414 
00415   /** Convenience typedef to access registry entries */     
00416   typedef std::map<std::string, TypeDefinition*>::iterator iterator;
00417 
00418   /** Singleton instance */
00419   static TypeRegistry* mpInstance;
00420 
00421   /** Constructor */
00422   TypeRegistry(){}
00423 
00424   /** Destructor */
00425   virtual ~TypeRegistry(){
00426     Clear();
00427   }
00428 
00429   /** Map to associate labels and faudes::TypeDefinitions. */
00430   std::map<std::string, TypeDefinition*> mNameToTypeDef;
00431   std::map<std::string, TypeDefinition*> mIdToTypeDef;
00432 
00433 }; // TypeRegistry
00434 
00435 
00436 /**
00437  * Auto register faudes-type with specified type name.
00438  *
00439  * This is a convenience class template to automize faudes type registration.
00440  * It uses the Insert template of the type registry. If the type name 
00441  * is already registered, no registration will take place and the old
00442  * configuration is maintained. Also registration with faudes-type name "Void" 
00443  * will be silently ignored.
00444  * Type documentation is not supported but may
00445  * be added via MergeDocumentation. 
00446  *
00447  * @tparam T
00448  *   Template parameter to specify the C++ type to register
00449  * @param rTypeName
00450  *   Specify the faudes-type name 
00451  */
00452 template<class T>
00453 class AutoRegisterType {
00454  public:
00455   AutoRegisterType(const std::string& rTypeName="Void") {
00456     if(rTypeName=="Void") return;
00457     if(TypeRegistry::G()->Exists(rTypeName)) return;
00458     FD_DREG("AutoRegisterType(" << rTypeName << "): by prototype template with " << typeid(T).name());
00459     TypeRegistry::G()->Insert<T>(rTypeName);
00460     TypeRegistry::G()->AutoRegistered(rTypeName,true);
00461   };
00462 };
00463 
00464 template<class T>
00465 class AutoRegisterXElementTag {
00466  public:
00467   AutoRegisterXElementTag(const std::string& rTypeName, const std::string& rTag) {
00468     static AutoRegisterType<T> srego(rTypeName);
00469     TypeRegistry::G()->XElementTag(rTypeName,rTag);
00470   };
00471 };
00472 
00473 
00474 
00475 
00476 /**
00477  * The FunctionRegistry registers faudes-functions. A faudes-functions
00478  * operates on faudes objects, eg the parallel composition of two 
00479  * generators is available as faudes-function. The registry maintains a
00480  * mapping between function names and a coresponding function::Definition.
00481  * The latter provides signatures, ie parameter types the function can 
00482  * take. The registry provides an interface to inspect 
00483  * TypeDefinitions or to construct function objects by their type name. 
00484  *
00485  * Technical note: the class is implemented according to the \"Singleton\" design 
00486  * pattern, ie, only one global instance of the registry can exist.
00487  *
00488  * @ingroup RunTimeInterface
00489  */
00490 
00491 class FunctionRegistry : public Type {
00492 
00493 public:
00494 
00495   /** Convenience typedef to access registry entries */     
00496   typedef std::map<std::string, FunctionDefinition*>::const_iterator Iterator;
00497 
00498   /**
00499    * Method to access the single global instance of the registry.
00500    */
00501   static FunctionRegistry* G();
00502 
00503   /** 
00504    * Clear all registered function definitions. This will also delete the
00505    * correponsing prototype objects.
00506    */
00507   void Clear();
00508 
00509   /**
00510    * Return number of registered function definitions.
00511    *
00512    * @return
00513    *  Size of map.
00514    */
00515   int Size() const;
00516 
00517   /**
00518    * Test existence of a faudes-function by its name.
00519    *
00520    * @param rName
00521    *  Name of function to look up
00522    *
00523    * @return
00524    *  True, if a corresponding definition is registered.
00525    */
00526   bool Exists(const std::string& rName) const;
00527 
00528   /**
00529    * Test existence of a faudes-function by faudes object
00530    *
00531    * @param rFunction
00532    *  Object of function to look up
00533    *
00534    * @return
00535    *  True, if a corresponding definition is registered.
00536    */
00537   bool Exists(const Function& rFunction) const;
00538 
00539   /**
00540    * STL interator to the internal function-name map.
00541    *
00542    * @return
00543    *  Iterator to the first element.
00544    */
00545   Iterator Begin(void) const;
00546 
00547   /**
00548    * STL interator to the internal function-name map.
00549    *
00550    * @return
00551    *  Iterator to the end of the map.
00552    */
00553   Iterator End(void) const;
00554 
00555   /**
00556    * Add another function definition to the registry.
00557    *
00558    * The registry takes the ownership pf the provided
00559    * function definition. It will be deleted either in Clear() or 
00560    * when the registry is destructed.
00561    *
00562    * @param pFunctionDef
00563    *  Function definition to insert
00564    *
00565    * @exception Exception
00566    *  - Identical name found (id 46)
00567    */
00568   void Insert(FunctionDefinition* pFunctionDef);
00569 
00570   /**
00571    * Register a faudes-function with specified function name.
00572    *
00573    * This is a convenience function: it uses the template parameter to
00574    * construct the new instance of FunctionDefinition to be registered. However,
00575    * no documentation is added. See also MergeDocumentation.
00576    *
00577    * @tparam T
00578    *   Template parameter to specify c++ function to register
00579    * @param rFunctionName
00580    *   Specify the faudes-function name 
00581    * @exception Exception
00582    *  - Identical name found (id 46)
00583    */
00584   template<class T>
00585   void Insert(const std::string& rFunctionName="") {
00586     FD_DRTI("FunctionRegistry::Insert<>(" << rFunctionName << ")");
00587     FunctionDefinition* td = FunctionDefinition::Constructor<T>(rFunctionName);
00588     Insert(td);
00589   }
00590 
00591   /**
00592    * Scan token input for function documentation.
00593    * This function scans the entire token stream for sections
00594    * with label "FunctionDefinition". Any such section that refers to a function name
00595    * which is known to the registry, will be applied to the corresponding 
00596    * registry entry.
00597    *
00598    *
00599    * @param rTr
00600    *  Token stream.
00601    * @exception Exception
00602    *  - Token mismatch (id 50, 51, 52)
00603    *  - IO Error (id 1)
00604    */
00605   void MergeDocumentation(TokenReader& rTr);
00606 
00607   /**
00608    * Scan file for function documentation.
00609    * Convenience method, see also MergeDocumentation(TokenReader& rTr)
00610    *
00611    * @param rFileName
00612    *  Name of file to scan.
00613    * @exception Exception
00614    *  - Token mismatch (id 50, 51, 52)
00615    *  - IO Error (id 1)
00616    */
00617   void MergeDocumentation(const std::string& rFileName);
00618 
00619   /**
00620    * Construct a faudes object by function name
00621    *
00622    * Uses the internal prototype object to construct
00623    * an object of the same c function on the heap. 
00624    *
00625    * @param rFunctionName
00626    *  Label of FunctionDefinition to search for.
00627    * @return
00628    *  Pointer to new faudes::Function instance 
00629    * @exception Exception
00630    *  - Unknown function (id 47)
00631    */
00632   Function* NewFunction(const std::string& rFunctionName) const;
00633 
00634   /**
00635    * Construct a faudes object by protofunction object.
00636    *
00637    * Depreciated: use new on the faudes object instead.
00638    *
00639    * @param rFunction
00640    *  Protofunction object.
00641    *
00642    * @return
00643    *  Pointer to new faudes::Function instance 
00644    * @exception Exception
00645    *  - Unknown function (id 47)
00646    */
00647   Function* NewFunction(const Function& rFunction) const;
00648 
00649 
00650   /**
00651    * Look up the function definition by faudes-function name
00652    *
00653    * @param rFunctionName
00654    *  Label of faudes::FunctionDefinition to search for.
00655    *
00656    * @return
00657    *  Reference to faudes::FunctionDefinition
00658    *
00659    * @exception Exception
00660    *  - Unknown function (id 46)
00661    */
00662   const FunctionDefinition& Definition(const std::string& rFunctionName) const;
00663 
00664   /**
00665    * Look up the function definition by faudes object
00666    *
00667    * Techcal note: this implementation is slow, we should
00668    * use a function id map. 
00669    *
00670    * @param rFunction
00671    *  Reference to faudes::Function to search for.
00672    *
00673    * @return
00674    *  Reference to faudes::FunctionDefinition
00675    *
00676    * @exception Exception
00677    *  - Unknown function (id 46)
00678    */
00679   const FunctionDefinition& Definition(const Function& rFunction) const;
00680 
00681   /**
00682    * Look up the function name by faudes object
00683    *
00684    * @param rFunction
00685    *  Reference to faudes::Function to search for.
00686    *
00687    * @return
00688    *  Function name as string or "" if unknown.
00689    *
00690    */
00691   const std::string& FunctionName(const Function& rFunction) const;
00692 
00693  protected:
00694 
00695   /**
00696    * Write registry data of this to TokenWriter.
00697    *
00698    * Since the registry cannot reconfigure itself from a token stream,
00699    * this output is informative only. However, MergeDocumentation will 
00700    * accept the format to insert/extract documentation.
00701    *
00702    * @param rTw
00703    *   Reference to TokenWriter
00704    * @param rLabel
00705    *   Label of section to write
00706    * @param pContext
00707    *   Write context to provide contextual information
00708    *
00709    * @exception Exception 
00710    *   - IO errors (id 2)
00711    */
00712   virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="",const Type* pContext=0) const;
00713 
00714   /** Convenience typedef to access registry entries */     
00715   typedef std::map<std::string, FunctionDefinition*>::iterator iterator;
00716 
00717   /** Singleton instance */
00718   static FunctionRegistry* mpInstance;
00719 
00720   /** Constructor */
00721   FunctionRegistry(){}
00722 
00723   /** Destructor */
00724   virtual ~FunctionRegistry(){
00725     Clear();
00726   }
00727 
00728   /** Map to associate labels and faudes::FunctionDefinitions. */
00729   std::map<std::string, FunctionDefinition*> mNameToFunctionDef;
00730   std::map<std::string, FunctionDefinition*> mIdToFunctionDef;
00731 
00732 }; // FunctionRegistry
00733 
00734 
00735 /** 
00736  * Load all registered types and functions.
00737  *
00738  * The default file is some not so educated guess, so you
00739  * should specify it explicitely.
00740  *
00741  * @param rPath
00742  *   Source file
00743  *
00744  * @ingroup RunTimeInterface
00745  */
00746 
00747 void LoadRegistry(const std::string& rPath="");
00748 
00749 
00750 /** 
00751  * Dump all registered types and functions
00752  *
00753  * The destinations defaults to stdout.
00754  *
00755  * @param rPath
00756  *   Destination file
00757  *
00758  * @ingroup RunTimeInterface
00759  */
00760 
00761 void SaveRegistry(const std::string& rPath="");
00762 
00763 
00764 /** 
00765  * Clear all registry
00766  *
00767  * @ingroup RunTimeInterface
00768  */
00769 
00770 void ClearRegistry(void);
00771 
00772 
00773 /** 
00774  * Instantiate faudes typed objects by type name.
00775  * Convenience function to access registry singleton.
00776  * 
00777  * @param rTypeName
00778  *  Type to instantiate
00779  *
00780  * @ingroup RunTimeInterface
00781  */
00782 
00783 Type* NewFaudesObject(const std::string& rTypeName);
00784 
00785 /** 
00786  * Query type name.
00787  * Convenience function to access registry singleton.
00788  * 
00789  * @param rObject
00790  *  Faudes object instance
00791  * @return
00792  *  Faudes type name or "" if unkown.
00793  *
00794  * @ingroup RunTimeInterface
00795  */
00796 
00797 const std::string& FaudesTypeName(const Type& rObject);
00798 
00799 
00800 /** 
00801  * Test type compatibility.
00802  * Convenience function to access registry singleton.
00803  * 
00804  * @param rTypeName
00805  *  Faudes type name
00806  * @param rObject
00807  *  Faudes object instance
00808  * @return
00809  *  True, if object can be casted to specified faudes type.
00810  *
00811  * @ingroup RunTimeInterface
00812  */
00813 bool FaudesTypeTest(const std::string& rTypeName, const Type& rObject);
00814 
00815 
00816 /** 
00817  * Instantiate faudes function objects by function name.
00818  * Convenience function to access registry singleton.
00819  *
00820  * @param rFunctName
00821  *  Function to instantiate
00822  *
00823  * @ingroup RunTimeInterface
00824  */
00825 
00826 Function* NewFaudesFunction(const std::string& rFunctName);
00827 
00828 /** 
00829  * Query function name.
00830  * Convenience function to access registry singleton.
00831  * 
00832  * @param rObject
00833  *  Faudes object instance
00834  * @return
00835  *  Faudes function name or "" if unkown.
00836  *
00837  * @ingroup RunTimeInterface
00838  */
00839 
00840 const std::string& FaudesFunctionName(const Type& rObject);
00841 
00842 
00843 
00844 /**********************************************************************************************
00845 ***********************************************************************************************
00846 ***********************************************************************************************
00847 
00848 Implemention of template members functions
00849 
00850 ***********************************************************************************************
00851 ***********************************************************************************************
00852 **********************************************************************************************/
00853 
00854 
00855 
00856 
00857 
00858 } // namespace
00859 
00860 #endif /* FAUDES_RTIREGISTRY_H */

libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen