Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

mitkStaticOOP.h

00001 /*=========================================================================
00002 
00003   Program:   3DMed
00004   Date:      $Date: 2014-02-25 18:30:00 +0800 $
00005   Version:   $Version: 4.6.0 $
00006   Copyright: MIPG, Institute of Automation, Chinese Academy of Sciences
00007 
00008 =========================================================================*/
00009 
00010 #ifndef _mitkStaticOOP_h
00011 #define _mitkStaticOOP_h
00012 
00013 #include "mitkVisualization2Includes.h"
00014 #include <string>
00015 #include <map>
00016 #include <vector>
00017 
00018 struct MITK_VISUALIZATION2_API mitkParameter
00019 {
00020     std::string cls;
00021     std::string name;
00022     unsigned size;
00023     void *data;
00024 
00025     mitkParameter()
00026     {
00027         this->size=0;
00028         this->data=0;
00029     }
00030 
00031     mitkParameter(const char* cls, const char* name, unsigned size, void* data)
00032     {
00033         this->cls=cls;
00034         this->name=name;
00035         this->size=size;
00036         this->data=malloc(size);
00037         memcpy(this->data,data,size);
00038     }
00039     mitkParameter(const mitkParameter& p)
00040     {
00041         this->cls=p.cls;
00042         this->name=p.name;
00043         this->size=p.size;
00044         this->data=malloc(p.size);
00045         memcpy(this->data,p.data,size);
00046     }
00047     mitkParameter& operator=(const mitkParameter& p)
00048     {
00049         this->cls=p.cls;
00050         this->name=p.name;
00051         this->size=p.size;
00052         this->data=malloc(p.size);
00053         memcpy(this->data,p.data,size);
00054         return *this;
00055     }
00056     ~mitkParameter()
00057     {
00058         free(data);
00059     }
00060 };
00061 
00062 class mitkStaticClassList;
00063 class MITK_VISUALIZATION2_API mitkStaticClass
00064 {
00065 public:
00066     mitkStaticClass(const char* name,mitkStaticClassList* list);
00067     virtual ~mitkStaticClass();
00068     const char* GetName();
00069     virtual std::string GetCode()=0;
00070     std::string GetPMCode();
00071     mitkStaticClassList* GetList() {return m_ClsList;}
00072 
00073     virtual void BuildParameterList(void* data, std::vector<mitkParameter>& paramList, const char* prefix=0){}
00074 
00075 protected:
00076     static void _addToParamList(std::vector<mitkParameter>& paramList,const char* cls, const char* name, unsigned size, void* data,const char* prefix);
00077     void _buildParamList_part(const char* name, void* data, std::vector<mitkParameter>& paramList, const char* prefix=0, const char* prefix2=0);
00078 
00079 private:
00080     std::string m_Name;
00081     mitkStaticClassList* m_ClsList;
00082 };
00083 
00084 class MITK_VISUALIZATION2_API mitkStaticClassList : public std::map<std::string,mitkStaticClass*>
00085 {
00086 public:
00087     mitkStaticClassList();
00088     virtual ~mitkStaticClassList();
00089 };
00090 
00091 MITK_VISUALIZATION2_API std::string GenerateCCode(const char* PMCode);
00092 
00093 #endif

Generated on Tue Feb 25 15:00:37 2014 for MITK (Medical Imaging ToolKit) by  doxygen 1.4.3