本文整理汇总了C++中Package::getID方法的典型用法代码示例。如果您正苦于以下问题:C++ Package::getID方法的具体用法?C++ Package::getID怎么用?C++ Package::getID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Package
的用法示例。
在下文中一共展示了Package::getID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processPackage
void AbstractHost::processPackage()
{
Package *constructedPackage = new Package(parseBuffer);
if(!constructedPackage->isValid())
{
sendPackage(constructAcknowledgementPackage(constructedPackage, "invalid"));
delete constructedPackage;
}
else if(!server->packageRouterInstance()->isAllowed(type, constructedPackage))
{
sendPackageAndDelete(constructAcknowledgementPackage(constructedPackage, "forbidden"));
delete constructedPackage;
}
else if(constructedPackage->getType() == ConnectionManagement)
{
updateNextPackageID(constructedPackage->getID());
handlePackage(constructedPackage);
}
else if(state == Established)
{
updateNextPackageID(constructedPackage->getID());
server->packageRouterInstance()->processPackage(this, constructedPackage);
}
else
{
sendPackage(constructAcknowledgementPackage(constructedPackage, "invalid"));
delete constructedPackage;
}
parseBuffer.clear();
}
示例2: AbstractHost
Controller::Controller(int serverSocket, bool displayStati) : AbstractHost(serverSocket), stdinWatcher(NULL), commands(NULL), lastSendPackageID(0), waitingForAck(false), maxCommandNameLength(0)
{
this->displayStati = displayStati;
std::cout<<std::endl;
std::cout<<" _ ._ _| _ ._ |_ _ "<<std::endl;
std::cout<<" \\/(_)| |(_|(/_| |_)(_)\\/"<<std::endl;
std::cout<<" / / "<<std::endl;
std::cout<<std::endl;
commands = new std::map<std::string, CommandParser*>();
parseSpecFile(configuration->retrieveAsPath("general","net-spec"));
if(maxCommandNameLength<4) { maxCommandNameLength = 4; } // for the case where the "help" command is the longest
commands->insert(std::make_pair("help", new HelpCommandParser(commands, maxCommandNameLength)));
// setup stdin read watcher and readline library
rl_attempted_completion_function = &Controller::completionCallback;
using_history();
stdinWatcher = new ev::io();
stdinWatcher->set<Controller, &Controller::stdinCallback>(this);
Package *initPackage;
if(displayStati)
{
initPackage = constructPackage("connection-management", "id", getNextPackageID().c_str(), "command", "initialize", "client-name", PROJECT_NAME, "client-version", PROJECT_VERSION, "can-display-stati", "", "interactive", "", "can-handle-requests", "", NULL);
}
else
{
initPackage = constructPackage("connection-management", "id", getNextPackageID().c_str(), "command", "initialize", "client-name", PROJECT_NAME, "client-version", PROJECT_VERSION, "interactive", "", "can-handle-requests", "", NULL);
}
lastSendPackageID = initPackage->getID();
waitingForAck = true;
sendPackageAndDelete(initPackage);
}