本文整理汇总了C++中Connection函数的典型用法代码示例。如果您正苦于以下问题:C++ Connection函数的具体用法?C++ Connection怎么用?C++ Connection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Connection函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: group
std::vector<std::unique_ptr<Group> > Group::ConstructLoopbackMesh(
size_t num_hosts) {
// construct a group of num_hosts
std::vector<std::unique_ptr<Group> > group(num_hosts);
for (size_t i = 0; i < num_hosts; ++i) {
group[i] = std::make_unique<Group>(i, num_hosts);
}
// construct a stream socket pair for (i,j) with i < j
for (size_t i = 0; i != num_hosts; ++i) {
for (size_t j = i + 1; j < num_hosts; ++j) {
LOG << "doing Socket::CreatePair() for i=" << i << " j=" << j;
std::pair<Socket, Socket> sp = Socket::CreatePair();
group[i]->connections_[j] = Connection(std::move(sp.first));
group[j]->connections_[i] = Connection(std::move(sp.second));
group[i]->connections_[j].is_loopback_ = true;
group[j]->connections_[i].is_loopback_ = true;
}
}
return group;
}
示例2: OstTraceFunctionEntry0
/**
Parses the PTPIP header, gets and validates that the packet type is correct
and sets the value of the packet length.
@return Type The PTPIP packet type received ie event or cancel. In case of invalid type, it returns 0
*/
TInt CPTPIPEventHandler::ParsePTPIPHeaderL()
{
OstTraceFunctionEntry0( CPTPIPEVENTHANDLER_PARSEPTPIPHEADERL_ENTRY );
TUint32 type = Connection().ValidateAndSetEventPayloadL();
iPTPPacketLength = Connection().EventContainer()->Uint32L(CPTPIPGenericContainer::EPacketLength);
OstTraceFunctionExit0( CPTPIPEVENTHANDLER_PARSEPTPIPHEADERL_EXIT );
return type;
}
示例3: printf
void
SkyBoxConnector::keyPress(char key)
{
if(SCENE->camera->GetTarget() == (IGObject*)this->Connection())
{
if(key>='0' && key<'9')
{
if(lastKey!=key)
{
current=(key-48>=0 && key-48<=5)? key-48 : 6;
printf("SKYBOX: sellected wall: %s\n", wallNames[current]);
}
lastKey=key;
}
else if(key=='l')
{
if(lastKey!='l')
{
((SkyBox*)Connection())->LoadeHightMap(files[currentSellection],bumpmapchannel,current>5? -1:current);
if(++bumpmapchannel>3)
bumpmapchannel=0;
}
lastKey='l';
}
else if(key=='x')
{
if(lastKey!='x')
{
currentSellection=currentSellection==5?0:currentSellection+1;
printf("Sellected Image: %s\n",files[currentSellection]);
}
lastKey='x';
}
else if(key=='r')
{
if(lastKey!='r')
{
((SkyBox*)Connection())->LoadeColorMap(files[currentSellection],current>5? -1:current);
}
lastKey='r';
}
else for(int i=0;i<6;i++)
{
current = i;
vConnection()->Get<VoxControl>()->keyPress(key);
}
}
}
示例4: BasicTest
static void BasicTest()
{
// Replace this URL with your own URL:
XmlRpcClient Connection("http://web.edval.com.au/rpc");
Connection.setIgnoreCertificateAuthority();
//Connection.setBasicAuth_Callback(PopUpAPrettyDialog);
Connection.setBasicAuth_UsernameAndPassword("foo", "goo");
// Call: arumate.getKilowatts(string, integer) :
XmlRpcValue args, result;
args[0] = "test";
args[1] = 1;
//
double g = 3.14159;
XmlRpcValue binary(&g, sizeof(g));
args[2] = binary;
XmlRpcValue::BinaryData bdata = binary;
// Replace this function name with your own:
if (! Connection.execute("getKilowatts", args, result)) {
std::cout << Connection.getError();
}
else if (result.getType() == XmlRpcValue::TypeString)
std::cout << result.GetStdString();
else std::cout << "Success\n";
}
示例5:
Neuron::Neuron(unsigned numberOutputs, unsigned index, const string &transferFunction) {
for (unsigned c = 0; c < numberOutputs; c++) {
outputWeights.push_back(Connection());
}
this->index=index;
this->transferFunction=transferFunction;
}
示例6: Connection
void ConnectionManager::addConnection(SIN& addr) {
std::map<SIN, Connection>::iterator it;
if ((it = conn_map.find(addr)) == conn_map.end())
conn_map.insert(ConnectionRecord(addr, Connection(parent, *this, addr)));
else
throw CONN_DUP;
}
示例7: Enum
const std::vector<std::string> Environment::ScanPorts() const
{
std::vector<std::string> validNames;
std::string portName;
for(unsigned int i = 1; i < 17; i++)
{
portName = "Com";
portName.append( boost::lexical_cast<std::string>(i));
#ifdef SERIALCONNECTION_DEBUG
std::cout << "Trying port name: " << portName << "...";
#endif // SERIALCONNECTION_DEBUG
SerialDeviceEnumeration Enum(portName, 9600);
SerialConnection Connection(io_service, Enum);
if( !Connection.Connect() )
{
#ifdef SERIALCONNECTION_DEBUG
std::cout << "valid.\n";
#endif // SERIALCONNECTION_DEBUG
validNames.push_back(portName);
}
else
{
#ifdef SERIALCONNECTION_DEBUG
std::cout << "invalid.\n";
#endif // SERIALCONNECTION_DEBUG
}
Connection.Disconnect();
}
return validNames;
}
示例8: Connection
Connection Signal<_Res (_ArgTypes...), Combiner>::connect(const SlotType& _slot)
{
auto newConnectionBody = std::make_shared<ConnectionBodyType>(_slot);
mConnectionBodies.insert(newConnectionBody);
return Connection(std::move(newConnectionBody));
}
示例9: NETLIST_OBJECT
void SCH_TEXT::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
SCH_SHEET_PATH* aSheetPath )
{
if( GetLayer() == LAYER_NOTES || GetLayer() == LAYER_SHEETLABEL )
return;
NETLIST_OBJECT* item = new NETLIST_OBJECT();
item->m_SheetPath = *aSheetPath;
item->m_SheetPathInclude = *aSheetPath;
item->m_Comp = (SCH_ITEM*) this;
item->m_Type = NET_LABEL;
if( GetLayer() == LAYER_GLOBLABEL )
item->m_Type = NET_GLOBLABEL;
else if( GetLayer() == LAYER_HIERLABEL )
item->m_Type = NET_HIERLABEL;
item->m_Label = m_Text;
item->m_Start = item->m_End = GetTextPos();
aNetListItems.push_back( item );
// If a bus connects to label
if( Connection( *aSheetPath )->IsBusLabel( m_Text ) )
{
item->ConvertBusToNetListItems( aNetListItems );
}
}
示例10: main
int main(int argc, char *argv[])
{
int sock, x = 0;
char *Path = argv[1], *Pro_Sea = argv[2], *Host = argv[3];
puts("[+] NsT-phpBBDoS v0.1 by HaCkZaTaN");
puts("[+] NeoSecurityTeam");
puts("[+] Dos has begun....[+]\n");
fflush(stdout);
if(argc != 4) Use(argv[0]);
while(1)
{
sock = Connection(Host,80);
Write_In(sock, Path, Pro_Sea, Host, x);
#ifndef WIN32
shutdown(sock, SHUT_WR);
close(sock);
#else
closesocket(sock);
WSACleanup();
#endif
Pro_Sea = argv[2];
x++;
}
//I don't think that it will get here =)
return 0;
}
示例11: MOZ_ASSERT
nsresult
TLSFilterTransaction::ReadSegments(nsAHttpSegmentReader *aReader,
uint32_t aCount, uint32_t *outCountRead)
{
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
LOG(("TLSFilterTransaction::ReadSegments %p max=%d\n", this, aCount));
if (!mTransaction) {
return NS_ERROR_UNEXPECTED;
}
mReadSegmentBlocked = false;
mSegmentReader = aReader;
nsresult rv = mTransaction->ReadSegments(this, aCount, outCountRead);
LOG(("TLSFilterTransaction %p called trans->ReadSegments rv=%x %d\n",
this, rv, *outCountRead));
if (NS_SUCCEEDED(rv) && mReadSegmentBlocked) {
rv = NS_BASE_STREAM_WOULD_BLOCK;
LOG(("TLSFilterTransaction %p read segment blocked found rv=%x\n",
this, rv));
Connection()->ForceSend();
}
return rv;
}
示例12: disconnecT
/******************************************************************************
* Disconnect from the timer. The timer is stopped if no longer needed.
*/
void SynchTimer::disconnecT(QObject* receiver, const char* member)
{
if (mTimer)
{
mTimer->disconnect(receiver, member);
if (member)
{
int i = mConnections.indexOf(Connection(receiver, member));
if (i >= 0)
mConnections.removeAt(i);
}
else
{
for (int i = 0; i < mConnections.count(); )
{
if (mConnections[i].receiver == receiver)
mConnections.removeAt(i);
else
++i;
}
}
if (mConnections.isEmpty())
{
mTimer->disconnect();
mTimer->stop();
}
}
}
示例13: req
/**
Sends a response to the initiator.
@param aCode MTP response code
*/
void CMTPGetObjectPropsSupported::SendResponseL(TUint16 aCode)
{
const TMTPTypeRequest& req(Request());
iResponse.SetUint16(TMTPTypeResponse::EResponseCode, aCode);
iResponse.SetUint32(TMTPTypeResponse::EResponseSessionID, req.Uint32(TMTPTypeRequest::ERequestSessionID));
iResponse.SetUint32(TMTPTypeResponse::EResponseTransactionID, req.Uint32(TMTPTypeRequest::ERequestTransactionID));
iFramework.SendResponseL(iResponse, req, Connection());
}
示例14: Connection
bool MysqlCon::CheckConnection()
{
if (NULL == m_mysql)
{
return Connection();
}
return m_isConnect;
}
示例15: randomWeight
Neuron::Neuron(unsigned numOutputs, unsigned myIndex)
{
for (unsigned c = 0; c < numOutputs; ++c) {
m_outputWeights.push_back(Connection());
m_outputWeights.back().weight = randomWeight();
}
m_myIndex = myIndex;
}