本文整理汇总了C++中sid函数的典型用法代码示例。如果您正苦于以下问题:C++ sid函数的具体用法?C++ sid怎么用?C++ sid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sid
int CSkypeProto::RevokeAuth(WPARAM wParam, LPARAM lParam)
{
CContact::Ref contact;
MCONTACT hContact = (MCONTACT)wParam;
SEString sid(_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)));
if (this->GetContact(sid, contact))
{
if (contact->SetBuddyStatus(false))
this->setByte(hContact, "Grant", 1);
this->contactList.remove_val(contact);
}
return 0;
}
示例2: while
void Router::doClose(Connection *conn, RouterMsg *pMsg)
{
GatewayInfo *pInfo = (GatewayInfo*)conn->getData();
int pos = 0;
while(pos + SID_LENGTH <= pMsg->slen){
std::string sid(pMsg->data + pos, SID_LENGTH);
LOG("close connection, sid=%s", sid.c_str());
allSessions.erase(sid);
pInfo->sessions.erase(sid);
pos+= SID_LENGTH;
}
}
示例3: ul
// session 可读
void TcpListener::event_readable(TcpSession::TcpSessionWptr session)
{
auto sptr = std::move(session.lock());
if (!sptr)
{
return;
}
std::uint32_t sid = sptr->sid();
// 添加到事件列表
std::unique_lock<std::mutex> ul(m_mtx_ev);
m_events.push_back(std::bind(&TcpListener::fun_session_readable, this, sid));
ul.unlock();
}
示例4: sid
MCONTACT CSkypeProto::AddContact(CContact::Ref contact, bool isTemporary)
{
ptrW sid(::mir_utf8decodeW(contact->GetSid()));
CContact::AVAILABILITY availability;
contact->GetPropAvailability(availability);
MCONTACT hContact = this->GetContactBySid(sid);
if ( !hContact)
{
hContact = (MCONTACT)::CallService(MS_DB_CONTACT_ADD, 0, 0);
::CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)this->m_szModuleName);
ptrW nick(::mir_utf8decodeW(contact->GetNick()));
switch(availability) {
case CContact::SKYPEOUT:
this->setByte(hContact, "IsSkypeOut", 1);
break;
case CContact::PENDINGAUTH:
::db_set_b(hContact, "CList", "NotOnList", 1);
break;
case CContact::BLOCKED:
case CContact::BLOCKED_SKYPEOUT:
::db_set_b(hContact, "CList", "Hidden", 1);
break;
default:
this->delSetting(hContact, "IsSkypeOut");
::db_unset(hContact, "CList", "Hidden");
::db_unset(hContact, "CList", "NotOnList");
}
this->setTString(hContact, SKYPE_SETTINGS_SID, sid);
this->setTString(hContact, "Nick", nick);
DBVARIANT dbv;
if ( !this->getTString(SKYPE_SETTINGS_DEF_GROUP, &dbv))
{
::db_set_ts(hContact, "CList", "Group", dbv.ptszVal);
::db_free(&dbv);
}
}
return hContact;
}
示例5: assert
void PmpPimProtocol::onCreateProfile(PMPFrame * pFrame)
{
assert(pFrame);
assert(mEventFactory);
std::string str = bufferToString(pFrame->data,true);
unsigned int pos = stringInBufSize(str);
iviLink::Profile::Uid profileUid(str);
str = bufferToString(pFrame->data + pos,true);
pos += stringInBufSize(str);
iviLink::Profile::IUid piuid(str);
str = bufferToString(pFrame->data + pos,true);
iviLink::Service::Uid sid(str);
mEventFactory->pimProtocolCreateProfile(profileUid, piuid, sid);
}
示例6: while
void Worker::doKick(RouterMsg *pMsg)
{
int pos = 0;
while(pos + SID_LENGTH <= pMsg->slen)
{
std::string sid(pMsg->data + pos, SID_LENGTH);
LOG("kick user, sid=%s", sid.c_str());
ClientList::const_iterator it = arrClients.find(sid);
if(it != arrClients.end()){
Connection *pClient = it->second;
pClient->close();
}
pos+= SID_LENGTH;
}
}
示例7: availDevices
// Create a new sid emulation.
unsigned int InnovBuilder::create(unsigned int sids)
{
m_status = true;
// Check available devices
unsigned int count = availDevices();
if (count == 0)
{
m_errorBuffer = "Innovation SSI-2001 ERROR: No devices found";
goto InnovBuilder_create_error;
}
if (count < sids)
sids = count;
for (count = 0; count < sids; count++)
{
try
{
std::auto_ptr<Innov> sid(new Innov(this));
// SID init failed?
if (!sid->getStatus())
{
m_errorBuffer = sid->error();
goto InnovBuilder_create_error;
}
sidobjs.insert(sid.release());
}
// Memory alloc failed?
catch (std::bad_alloc const &)
{
m_errorBuffer.assign(name()).append(" ERROR: Unable to create Innov object");
goto InnovBuilder_create_error;
}
}
return count;
InnovBuilder_create_error:
m_status = false;
return count;
}
示例8: bufferToString
void CPmpPimClbCtrl::onProfileDied(PMPFrame * pFrame)
{
std::string str = bufferToString(pFrame->data,true);
unsigned int pos = stringInBufSize(str);
iviLink::Profile::IUid piuid(str);
str = bufferToString(pFrame->data + pos,true);
iviLink::Service::Uid sid(str);
mpPimClb->onProfileDied(piuid,sid);
PMPFrame pResp;
pResp.size = sizeof(PMPFrame);
pResp.frameType = PMP_FRAME_TYPE_RESPONSE;
pResp.id = pFrame->id;
pResp.client = pFrame->client;
pResp.reqType = pFrame->reqType;
mpProtocol->makeResponse(pResp);
}
示例9: readFixedLength
pBuffer SourceBase::
readFixedLength( const Interval& I )
{
TIME_SOURCEBASE TaskTimer tt("%s.%s %s",
vartype(*this).c_str(), __FUNCTION__ ,
I.toString().c_str() );
// Try a simple read
pBuffer p = readChecked( I );
if (I == p->getInterval())
return p;
// Didn't get exact result, prepare new Buffer
pBuffer r( new Buffer(I, p->sample_rate(), p->number_of_channels ()) );
for (int c=0; c<r->number_of_channels (); ++c)
{
#ifndef USE_CUDA
// Allocate cpu memory and prevent calling an unnecessary clear by flagging the store as up-to-date
CpuMemoryStorage::WriteAll<3>( r->getChannel (c)->waveform_data() );
#else
if (p->getChannel (c)->waveform_data()->HasValidContent<CudaGlobalStorage>())
CudaGlobalStorage::WriteAll<3>( r->getChannel (c)->waveform_data() );
else
CpuMemoryStorage::WriteAll<3>( r->getChannel (c)->waveform_data() );
#endif
}
Intervals sid(I);
while (sid)
{
if (!p)
p = readChecked( sid.fetchFirstInterval() );
sid -= p->getInterval();
TIME_SOURCEBASE_LINE((*r) |= *p); // Fill buffer
p.reset();
}
return r;
}
示例10: sid
bool CHalfLife2::GetServerSteam3Id(char *pszOut, size_t len) const
{
CSteamID sid(GetServerSteamId64());
switch (sid.GetEAccountType())
{
case k_EAccountTypeAnonGameServer:
ke::SafeSprintf(pszOut, len, "[A:%u:%u:%u]", sid.GetEUniverse(), sid.GetAccountID(), sid.GetUnAccountInstance());
break;
case k_EAccountTypeGameServer:
ke::SafeSprintf(pszOut, len, "[G:%u:%u]", sid.GetEUniverse(), sid.GetAccountID());
break;
case k_EAccountTypeInvalid:
ke::SafeSprintf(pszOut, len, "[I:%u:%u]", sid.GetEUniverse(), sid.GetAccountID());
break;
default:
return false;
}
return true;
}
示例11: lock
void GroupListModule_Impl::_groupUnreadCntResponse(CImPdu* pdu)
{
CImPduClientGroupUnreadMsgCntResponse* pduOfflineMsgCnt = (CImPduClientGroupUnreadMsgCntResponse*)pdu;
client_group_unread_cnt_t* pList = pduOfflineMsgCnt->GetGroupUnreadList();
for (UInt32 i = 0; i < pduOfflineMsgCnt->GetGroupUnreadCnt(); ++i)
{
client_group_unread_cnt_t pInfo = pList[i];
{
util::TTAutoLock lock(&m_lock);
std::string sid(pInfo.group_id_url, pInfo.group_id_len);
m_vecOfflineMsgGroup.push_back(sid);
logic::GetLogic()->pushBackOperationWithLambda(
[=]()
{
CImPduClientGroupUnreadMsgRequest pduData(sid.c_str());
logic::getTcpClientModule()->sendPacket(&pduData);
}
);
}
}
}
示例12: sid
const char *ReSIDBuilder::credits ()
{
m_status = true;
// Available devices
if (sidobjs.size ())
{
ReSID *sid = (ReSID *) sidobjs[0];
return sid->credits ();
}
{ // Create an emulation to obtain credits
ReSID sid(this);
if (!sid)
{
m_status = false;
strcpy (m_errorBuffer, sid.error ());
return 0;
}
return sid.credits ();
}
}
示例13: assert
void
vec4_gs_visitor::set_stream_control_data_bits(unsigned stream_id)
{
/* control_data_bits |= stream_id << ((2 * (vertex_count - 1)) % 32) */
/* Note: we are calling this *before* increasing vertex_count, so
* this->vertex_count == vertex_count - 1 in the formula above.
*/
/* Stream mode uses 2 bits per vertex */
assert(c->control_data_bits_per_vertex == 2);
/* Must be a valid stream */
assert(stream_id >= 0 && stream_id < MAX_VERTEX_STREAMS);
/* Control data bits are initialized to 0 so we don't have to set any
* bits when sending vertices to stream 0.
*/
if (stream_id == 0)
return;
/* reg::sid = stream_id */
src_reg sid(this, glsl_type::uint_type);
emit(MOV(dst_reg(sid), stream_id));
/* reg:shift_count = 2 * (vertex_count - 1) */
src_reg shift_count(this, glsl_type::uint_type);
emit(SHL(dst_reg(shift_count), this->vertex_count, 1u));
/* Note: we're relying on the fact that the GEN SHL instruction only pays
* attention to the lower 5 bits of its second source argument, so on this
* architecture, stream_id << 2 * (vertex_count - 1) is equivalent to
* stream_id << ((2 * (vertex_count - 1)) % 32).
*/
src_reg mask(this, glsl_type::uint_type);
emit(SHL(dst_reg(mask), sid, shift_count));
emit(OR(dst_reg(this->control_data_bits), this->control_data_bits, mask));
}
示例14: ensure_equals
void tester::test<14>()
{
BankSelection mixed;
mixed.MatchOnly(mixed_list);
ensure_equals("Has 2 wildcards", mixed.fWildCards.size(), 2u);
ensure_equals("Has 8 exact matches", mixed.fMatches.size(), 8u);
std::string msg;
msg = "Should not match ";
SourceID sid(ID::kScVe,ID::kNotApplicable,"general","default");
ensure(msg + sid.str(), !mixed.Includes(sid));
sid = SourceID(ID::kMuSc,ID::kNotApplicable,"wrong","default");
ensure(msg + sid.str(), !mixed.Includes(sid));
msg = "Should match ";
sid = SourceID(ID::kMuSc,ID::kNotApplicable,"general","default");
ensure(msg + sid.str(), mixed.Includes(sid));
sid = SourceID(ID::kSiR1_4, ID::kFast, "general", "default");
ensure(msg + sid.str(), mixed.Includes(sid));
}
示例15: sid
void randomizer_base::setupIOMappings( )
{
int ninput_streams = 0;
int noutput_streams = 0;
std::vector<std::string>::iterator pname;
std::string sid("");
int inMode=RealMode;
if ( !validGRBlock() ) return;
ninput_streams = gr_sptr->get_max_input_streams();
gr_io_signature_sptr g_isig = gr_sptr->input_signature();
noutput_streams = gr_sptr->get_max_output_streams();
gr_io_signature_sptr g_osig = gr_sptr->output_signature();
LOG_DEBUG( randomizer_base, "GNUHAWK IO MAPPINGS IN/OUT " << ninput_streams << "/" << noutput_streams );
//
// Someone reset the GR Block so we need to clean up old mappings if they exists
// we need to reset the io signatures and check the vlens
//
if ( _istreams.size() > 0 || _ostreams.size() > 0 ) {
LOG_DEBUG( randomizer_base, "RESET INPUT SIGNATURE SIZE:" << _istreams.size() );
IStreamList::iterator istream;
for ( int idx=0 ; istream != _istreams.end(); idx++, istream++ ) {
// re-add existing stream definitons
LOG_DEBUG( randomizer_base, "ADD READ INDEX TO GNU RADIO BLOCK");
if ( ninput_streams == -1 ) gr_sptr->add_read_index();
// setup io signature
istream->associate( gr_sptr );
}
LOG_DEBUG( randomizer_base, "RESET OUTPUT SIGNATURE SIZE:" << _ostreams.size() );
OStreamList::iterator ostream;
for ( int idx=0 ; ostream != _ostreams.end(); idx++, ostream++ ) {
// need to evaluate new settings...???
ostream->associate( gr_sptr );
}
return;
}
//
// Setup mapping of RH port to GNU RADIO Block input streams
// For version 1, we are ignoring the GNU Radio input stream -1 case that allows multiple data
// streams over a single connection. We are mapping a single RH Port to a single GNU Radio stream.
// Stream Identifiers will be pass along as they are received
//
LOG_TRACE( randomizer_base, "setupIOMappings INPUT PORTS: " << inPorts.size() );
pname = inputPortOrder.begin();
for( int i=0; pname != inputPortOrder.end(); pname++ ) {
// grab ports based on their order in the scd.xml file
RH_ProvidesPortMap::iterator p_in = inPorts.find(*pname);
if ( p_in != inPorts.end() ) {
bulkio::InOctetPort *port = dynamic_cast< bulkio::InOctetPort * >(p_in->second);
int mode = inMode;
sid = "";
// need to add read index to GNU Radio Block for processing streams when max_input == -1
if ( ninput_streams == -1 ) gr_sptr->add_read_index();
// check if we received SRI during setup
BULKIO::StreamSRISequence_var sris = port->activeSRIs();
if ( sris->length() > 0 ) {
BULKIO::StreamSRI sri = sris[sris->length()-1];
mode = sri.mode;
}
std::vector<int> in;
io_mapping.push_back( in );
_istreams.push_back( gr_istream< bulkio::InOctetPort > ( port, gr_sptr, i, mode, sid ));
LOG_DEBUG( randomizer_base, "ADDING INPUT MAP IDX:" << i << " SID:" << sid );
// increment port counter
i++;
}
}
//
// Setup mapping of RH port to GNU RADIO Block input streams
// For version 1, we are ignoring the GNU Radio output stream -1 case that allows multiple data
// streams over a single connection. We are mapping a single RH Port to a single GNU Radio stream.
//
LOG_TRACE( randomizer_base, "setupIOMappings OutputPorts: " << outPorts.size() );
pname = outputPortOrder.begin();
for( int i=0; pname != outputPortOrder.end(); pname++ ) {
// grab ports based on their order in the scd.xml file
RH_UsesPortMap::iterator p_out = outPorts.find(*pname);
if ( p_out != outPorts.end() ) {
bulkio::OutOctetPort *port = dynamic_cast< bulkio::OutOctetPort * >(p_out->second);
int idx = -1;
BULKIO::StreamSRI sri = createOutputSRI( i, idx );
if (idx == -1) idx = i;
if(idx < (int)io_mapping.size()) io_mapping[idx].push_back(i);
int mode = sri.mode;
sid = sri.streamID;
_ostreams.push_back( gr_ostream< bulkio::OutOctetPort > ( port, gr_sptr, i, mode, sid ));
//.........这里部分代码省略.........