예제 #1
0
int main(int argc, char** argv)
{
    std::cout << "Starting "<< std::endl;
    int type = 1;
    if(argc > 1)
    {
        if(strcmp(argv[1],"publisher")==0)
            type = 1;
        else if(strcmp(argv[1],"subscriber")==0)
            type = 2;
    }
    else
    {
        std::cout << "publisher OR subscriber argument needed"<<std::endl;
        Log::Reset();
        return 0;
    }

    //Log::SetVerbosity(Log::Info);
    //Log::SetCategoryFilter(std::regex("(SECURITY)"));

    switch(type)
    {
        case 1:
            {
                HelloWorldPublisher mypub;
                if(mypub.init())
                {
                    mypub.run(10);
                }
                break;
            }
        case 2:
            {
                HelloWorldSubscriber mysub;
                if(mysub.init())
                {
                    mysub.run();
                }
                break;
            }
    }
    Domain::stopAll();
    Log::Reset();
    return 0;
}
예제 #2
0
int main(int argc, char** argv)
{
	Log::setVerbosity(VERB_INFO);
	cout << "Starting "<< endl;
	int type = 1;
	if(argc > 1)
	{
		if(strcmp(argv[1],"publisher")==0)
			type = 1;
		else if(strcmp(argv[1],"subscriber")==0)
			type = 2;
	}
	else
	{
		cout << "publisher OR subscriber argument needed"<<endl;
		return 0;
	}


	switch(type)
	{
	case 1:
	{
		HelloWorldPublisher mypub;
		if(mypub.init())
		{
			mypub.run(10);
		}
		break;
	}
	case 2:
	{
		HelloWorldSubscriber mysub;
		if(mysub.init())
		{
			mysub.run();
		}
		break;
	}
	}
	Domain::stopAll();
	return 0;
}