VR-Forces 4.0.4 Class Documentation
include/vrvVrl/DtVrvControlFactory_v0.h
Go to the documentation of this file.
00001 
00002 /*******************************************************************************
00003 ** Copyright (c) 2010 MAK Technologies, Inc.
00004 ** All rights reserved.
00005 *******************************************************************************/
00006 
00009 
00010 #pragma once
00011 
00012 #include <vrvVrl/vrvControlToolkitDataTypes_v0.h>
00013 
00014 #include <map>
00015 
00016 namespace vrvControlToolkit
00017 {
00018 
00019    class DtVctBaseControlCreator_v0
00020    {
00021    public:
00022       DtVctBaseControlCreator_v0() {}
00023       virtual ~DtVctBaseControlCreator_v0() {}
00024 
00025       virtual DtVrvControl_v0* create()=0;
00026    };
00027 
00028    template <class ControlType>
00029    class DtVctControlCreator_v0 : public DtVctBaseControlCreator_v0
00030    {
00031    public:
00032       DtVctControlCreator_v0 () {}
00033       virtual ~DtVctControlCreator_v0() {}
00034 
00035       virtual DtVrvControl_v0* create();
00036    };
00037 
00038    template< class ControlType>
00039    DtVrvControl_v0* DtVctControlCreator_v0<ControlType>::create()
00040    {
00041       return new ControlType();
00042    }
00043 
00044    class DtVrvControlFactory_v0
00045    {
00046    public: 
00047       static DtVrvControlFactory_v0& instance();
00048 
00049       DtVrvControl_v0* create(const char* buffer, int size);
00050 
00051       typedef std::pair<DtVrvControlTypeEnum_v0, int> TypeVersionPair;
00052       virtual void addCreator(TypeVersionPair type, DtVctBaseControlCreator_v0* creator);
00053 
00054    protected:
00055       virtual void initialize();
00056 
00057       DtVrvControlFactory_v0();
00058       virtual ~DtVrvControlFactory_v0();
00059 
00060       static DtVrvControlFactory_v0* theControlFactory;
00061 
00062       typedef std::map<TypeVersionPair, DtVctBaseControlCreator_v0*> ControlCreatorMap;
00063       ControlCreatorMap myCreatorMap;
00064    };
00065 
00066 } //vrvControlToolkit::
00067 
00068 #include <vrvVrl/DtVrvControlFactory_v0.inl>

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)