VR-Forces 4.0.4 Class Documentation
include/vrfutil/stringAndIntKeyFactory.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 2007 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 /*******************************************************************************
00006 ** $RCSfile: stringAndIntKeyFactory.h,v $ $Revision: 1.2 $ $State: Exp $
00007 *******************************************************************************/
00008 
00011 
00013 
00014 #ifndef stringAndIntKeyFactory_h
00015 #define stringAndIntKeyFactory_h
00016 
00017 #include <vlutil/vlHashlist.h>
00018 
00026 template <typename T_CreationType>
00027 class DtStringAndIntKeyFactory
00028 {
00029 public:
00031    DtStringAndIntKeyFactory();
00032 
00033 private:
00035    DtStringAndIntKeyFactory(const DtStringAndIntKeyFactory& orig);
00037    const DtStringAndIntKeyFactory& operator=(const DtStringAndIntKeyFactory& 
00038       orig);
00039 
00040 public:
00042    virtual ~DtStringAndIntKeyFactory();
00043 
00044    typedef T_CreationType* (*DtCreatorFcn)();
00045 
00047    virtual void addCreatorFcn(const DtString& type, const int intType,
00048       DtCreatorFcn fcn);
00049 
00053 
00054    virtual T_CreationType* createItem(const DtString& type) const;
00055    virtual T_CreationType* createItem(int type) const;
00057 
00059    virtual int intTypeForStringType(const DtString& stringType) const;
00061    virtual DtString stringTypeForIntType(int intType);
00062 
00063    static DtStringAndIntKeyFactory<T_CreationType>* create();
00064 
00065 protected:
00069    virtual DtString creationTypeName() const;
00070 
00071 protected:
00072    struct DtStringAndIntKeyFactoryEntry {
00073       DtString                   myTypeToCreate;
00074       int                        myIntTypeToCreate;
00075       DtCreatorFcn               myCreatorFcn;
00076    };
00077 
00078 protected:
00079    DtHashlist myStringTypeHashlist;
00080    DtHashlist myIntTypeHashlist;
00081 };
00082 
00083 #define stringAndIntKeyFactory_inl_
00084 #include "vrfutil/stringAndIntKeyFactory.inl"
00085 #undef  stringAndIntKeyFactory_inl_
00086 
00087 #endif

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)