Skip to content

yangcancai/CamCommon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CamCommon

  • implement C++ Reflection and SmartPtr
  • memory leak detect use Visual Leak Detector
  • server classes with libevent

How to Install

  • Download something
  • Install and Setting
    • c/c++ -> General -> Additional Include Directories = C:\Program Files (x86)\Visual Leak Detector\include
    • Linker -> General -> Additional Library Directories = C:\Program Files (x86)\Visual Leak Detector\lib\Win32
    • c/c++ -> General -> Additional Include Directories = libevent\include
    • Linker -> General -> Additional Library Directories = libevent\lib
    • c/c++ -> command -> /D WIN32

How to use?

#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "libevent.lib")
int main(){

#ifdef WIN32
    WSADATA wsa_data;
	WSAStartup(0x0201, &wsa_data);
#endif
    IBootstrap &boot = BootstrapFactory::CreateBootstrap();
    SmartPtr<IAppServer> server(new AppServer());
	SmartPtr<IAppSession> session(new AppSession());
	boot.AddServer(server.own());
	boot.Start();
	boot.Loop();
    
    
    RefBaseClass* pVar = (RefBaseClass*)RefClassFactory::sharedClassFactory().createClassByName("RefHelloClass");
    int v = 5;
	pVar->registProperty();
	pVar->_propertyMap["set_pValue"](pVar, &v);
	pVar->display();
	pVar = (RefBaseClass*)RefClassFactory::sharedClassFactory().createClassByName("EchoTos");
    pVar->ExecuteCommand(NULL,NULL);
	v = 5;
	pVar->registProperty();
	pVar->_propertyMap["set_pValue"](pVar,&v);
	pVar->display();
	{
		Student* s = new Student(&ManagerClass::Instance());
	}
	cout << Student::new_count << endl;
	cout << Student::delete_count << endl;

	// SmartPtr
	SmartPtr<int> p(new int(5));
	cout << *p << endl;

	SmartPtr<HelloWorld> hello(new HelloWorld(88));
	cout << hello->a() << endl;
	SmartPtr<HelloWorld> hello1 = hello;
	hello1 = hello;
	SmartPtr<HelloWorld> hello3 = hello;
	SmartPtr<HelloWorld> hello4(new HelloWorld(88));
	hello3 = hello4;
	getchar();
	return 0;
}

Thanks

About author

If you have any quetions,please contact [email protected]

About

implement C++ Reflection and SmartPtr

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages