class data is like this:
struct Base_data
{
public:
Base_data(){
protocolname = "Base";
}
string protocolname;
};
class HttpData : public Base_data
{
public:
HttpData(){
protocolname = "Http";
}
};
class Professor:
class Base_Professor { public: void Process(Base_data &data) { std::map::const_iterator it = ListProfessor.find(data.protocolname); if(it == ListProfessor.end()) cout second->Do(data); } virtual void Do(Base_data &data){} virtual std::string GetProfessorname(){ return "Base"; } ~Base_Professor(){ std::map::const_iterator it; for(it = ListProfessor.begin(); it != ListProfessor.end(); ++it) delete it->second; } bool Register(Base_Professor *Professor){ std::map::const_iterator it = ListProfessor.find(Professor->GetProfessorname()); if(it != ListProfessor.end()) return false; ListProfessor.insert(std::make_pair(Professor->GetProfessorname(), Professor)); } private: std::map ListProfessor; }; class HttpProfessor : public Base_Professor { public: std::string GetProfessorname(){ return "Http"; } void Do(Base_data &data){ std::cout
I can add new protocol by inheritant Base_Professor and register new class but I have no ideal how to do that in lua. Do you have any ideal how to do that ?