本文整理汇总了C++中NF_SHARE_PTR类的典型用法代码示例。如果您正苦于以下问题:C++ NF_SHARE_PTR类的具体用法?C++ NF_SHARE_PTR怎么用?C++ NF_SHARE_PTR使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NF_SHARE_PTR类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetElement
NF_SHARE_PTR<NFIRecordManager> NFCClassModule::GetClassRecordManager(const std::string& strClassName)
{
NF_SHARE_PTR<NFIClass> pClass = GetElement(strClassName);
if (pClass)
{
return pClass->GetRecordManager();
}
return NULL;
}
示例2: CreateItemInTempBag
bool NFCPackModule::CreateItemInTempBag(const NFGUID & self, const std::string & strConfigName, const int nCount)
{
NF_SHARE_PTR<NFIRecord> pRecord = m_pKernelModule->FindRecord(self, NFrame::Player::TempItemList::ThisName());
if (nullptr == pRecord)
{
return false;
}
NFDataList varFindResult;
int nFindRowCount = pRecord->FindString(NFrame::Player::TempItemList::ConfigID, strConfigName, varFindResult);
if (nFindRowCount <= 0)
{
NF_SHARE_PTR<NFDataList> xRowData = pRecord->GetInitData();
xRowData->SetString(NFrame::Player::TempItemList::ConfigID, strConfigName);
xRowData->SetInt(NFrame::Player::TempItemList::ItemCount, nCount);
pRecord->AddRow(-1, *xRowData);
}
else
{
int nFindRow = varFindResult.Int32(0);
int nOldCount = pRecord->GetInt32(nFindRow, NFrame::Player::TempItemList::ItemCount);
int nNewCount = nOldCount + nCount;
pRecord->SetInt(nFindRow, NFrame::Player::TempItemList::ItemCount, nNewCount);
}
return true;
}
示例3: AfterInit
bool NFCProxyServerNet_ServerModule::AfterInit()
{
m_pKernelModule = pPluginManager->FindModule<NFIKernelModule>();
m_pLogicClassModule = pPluginManager->FindModule<NFILogicClassModule>();
m_pProxyToWorldModule = pPluginManager->FindModule<NFIProxyServerToWorldModule>();
m_pLogModule = pPluginManager->FindModule<NFILogModule>();
m_pElementModule = pPluginManager->FindModule<NFIElementModule>();
m_pUUIDModule = pPluginManager->FindModule<NFIUUIDModule>();
m_pProxyServerToGameModule = pPluginManager->FindModule<NFIProxyServerToGameModule>();
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_CONNECT_KEY, this, &NFCProxyServerNet_ServerModule::OnConnectKeyProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_WORLD_LIST, this, &NFCProxyServerNet_ServerModule::OnReqServerListProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_SELECT_SERVER, this, &NFCProxyServerNet_ServerModule::OnSelectServerProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_ROLE_LIST, this, &NFCProxyServerNet_ServerModule::OnReqRoleListProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_CREATE_ROLE, this, &NFCProxyServerNet_ServerModule::OnReqCreateRoleProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_DELETE_ROLE, this, &NFCProxyServerNet_ServerModule::OnReqDelRoleProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_ENTER_GAME, this, &NFCProxyServerNet_ServerModule::OnReqEnterGameServer);
m_pNetModule->AddReceiveCallBack(this, &NFCProxyServerNet_ServerModule::OnOtherMessage);
m_pNetModule->AddEventCallBack(this, &NFCProxyServerNet_ServerModule::OnSocketClientEvent);
NF_SHARE_PTR<NFILogicClass> xLogicClass = m_pLogicClassModule->GetElement("Server");
if (xLogicClass.get())
{
NFList<std::string>& xNameList = xLogicClass->GetConfigNameList();
std::string strConfigName;
for (bool bRet = xNameList.First(strConfigName); bRet; bRet = xNameList.Next(strConfigName))
{
const int nServerType = m_pElementModule->GetPropertyInt(strConfigName, "Type");
const int nServerID = m_pElementModule->GetPropertyInt(strConfigName, "ServerID");
if (nServerType == NF_SERVER_TYPES::NF_ST_PROXY && pPluginManager->AppID() == nServerID)
{
const int nPort = m_pElementModule->GetPropertyInt(strConfigName, "Port");
const int nMaxConnect = m_pElementModule->GetPropertyInt(strConfigName, "MaxOnline");
const int nCpus = m_pElementModule->GetPropertyInt(strConfigName, "CpuCount");
const std::string& strName = m_pElementModule->GetPropertyString(strConfigName, "Name");
const std::string& strIP = m_pElementModule->GetPropertyString(strConfigName, "IP");
m_pUUIDModule->SetIdentID(nServerID);
int nRet = m_pNetModule->Initialization(nMaxConnect, nPort, nCpus);
if (nRet < 0)
{
std::ostringstream strLog;
strLog << "Cannot init server net, Port = " << nPort;
m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, NULL_OBJECT, strLog, __FUNCTION__, __LINE__);
NFASSERT(nRet, "Cannot init server net", __FILE__, __FUNCTION__);
exit(0);
}
}
}
}
return true;
}
示例4: CreateContinerObject
bool NFCSceneProcessModule::CreateContinerObject( const int nContainerID, const int nGroupID, const std::string& strFileName, const std::string& strSeedID )
{
NF_SHARE_PTR<NFMapEx<std::string, SceneGroupResource>> pSceneResource = mtSceneResourceConfig.GetElement( nContainerID );
if ( pSceneResource.get() )
{
NF_SHARE_PTR<SceneGroupResource> pGroupResource = pSceneResource->GetElement( strFileName );
if ( pSceneResource.get() )
{
NF_SHARE_PTR<NFMapEx<std::string, SceneSeedResource>> pResourceList = pGroupResource->xSceneGroupResource.GetElement( "NPC" );
if ( pResourceList.get() )
{
NF_SHARE_PTR<SceneSeedResource> pResourceObject = pResourceList->GetElement( strSeedID );
if ( pResourceObject.get() )
{
const std::string& strClassName = m_pElementInfoModule->GetPropertyString(pResourceObject->strConfigID, "ClassName");
NFCDataList arg;
arg << "X" << pResourceObject->fSeedX;
arg << "Y" << pResourceObject->fSeedY;
arg << "Z" << pResourceObject->fSeedZ;
arg << "SeedID" << strSeedID;
m_pKernelModule->CreateObject( NFIDENTID(), nContainerID, nGroupID, strClassName, pResourceObject->strConfigID, arg );
}
}
}
}
return true;
}
示例5: OnObjectHeroRecordEvent
int NFCHeroPropertyModule::OnObjectHeroRecordEvent(const NFGUID& self, const RECORD_EVENT_DATA& xEventData, const NFIDataList::TData& oldVar, const NFIDataList::TData& newVar)
{
std::ostringstream stream;
NF_SHARE_PTR<NFIRecord> pHeroRecord = m_pKernelModule->FindRecord(self, xEventData.strRecordName);
if (nullptr == pHeroRecord)
{
return 0;
}
switch (xEventData.nOpType)
{
case NFIRecord::RecordOptype::Add:
{
const NFGUID& xHeroGUID = pHeroRecord->GetObject(xEventData.nRow, NFrame::Player::PlayerHero::PlayerHero_GUID);
OnHeroPropertyUpdate(self, xHeroGUID);
}
break;
case NFIRecord::RecordOptype::Del:
{
}
break;
case NFIRecord::RecordOptype::Update:
{
switch (xEventData.nCol)
{
case NFrame::Player::PlayerHero::PlayerHero_Level:
case NFrame::Player::PlayerHero::PlayerHero_Star:
case NFrame::Player::PlayerHero::PlayerHero_Equip1:
case NFrame::Player::PlayerHero::PlayerHero_Equip2:
case NFrame::Player::PlayerHero::PlayerHero_Equip3:
case NFrame::Player::PlayerHero::PlayerHero_Equip4:
case NFrame::Player::PlayerHero::PlayerHero_Equip5:
case NFrame::Player::PlayerHero::PlayerHero_Equip6:
case NFrame::Player::PlayerHero::PlayerHero_Talent1:
case NFrame::Player::PlayerHero::PlayerHero_Talent2:
case NFrame::Player::PlayerHero::PlayerHero_Talent3:
case NFrame::Player::PlayerHero::PlayerHero_Talent4:
case NFrame::Player::PlayerHero::PlayerHero_Talent5:
{
const NFGUID& xHeroGUID = pHeroRecord->GetObject(xEventData.nRow, NFrame::Player::PlayerHero::PlayerHero_GUID);
OnHeroPropertyUpdate(self, xHeroGUID);
}
break;
default:
break;
}
}
break;
default:
break;
}
return 0;
}
示例6: OnDisConnected
int OnDisConnected(const int fd, NFINet* pNet)
{
NF_SHARE_PTR<ServerData> pServerInfo = GetServerNetInfo(pNet);
if (pServerInfo.get())
{
RemoveServerWeightData(pServerInfo);
pServerInfo->eState = NFMsg::EServerState::EST_CRASH;
}
return 0;
}
示例7: OnConnected
int OnConnected(const int fd, NFINet* pNet)
{
NF_SHARE_PTR<ServerData> pServerInfo = GetServerNetInfo(pNet);
if (pServerInfo.get())
{
AddServerWeightData(pServerInfo);
pServerInfo->eState = NFMsg::EServerState::EST_NARMAL;
}
return 0;
}
示例8: RegisterCallback
bool NFCPropertyManager::RegisterCallback(const std::string& strProperty, const PROPERTY_EVENT_FUNCTOR_PTR& cb)
{
NF_SHARE_PTR<NFIProperty> pProperty = this->GetElement(strProperty);
if (pProperty)
{
pProperty->RegisterCallback(cb);
return true;
}
return false;
}
示例9: MakeRedisKey
bool NFCRankRedisModule::RemoveRangeByScore(const NFMsg::ERankType eRankType, const int nMin, const int nMax)
{
std::string strRankKey = MakeRedisKey(eRankType);
NF_SHARE_PTR<NFINoSqlDriver> pNoSqlDriver = m_pNoSqlModule->GetDriverBySuit(strRankKey);
if (!pNoSqlDriver)
{
return 0;
}
return pNoSqlDriver->ZRemRangeByScore(strRankKey, nMin, nMax);
}
示例10: CheckLoadGuild
void NFCWorldGuildDataModule::CheckLoadGuild( const NFIDENTID& self, const NFIDENTID& xGuild )
{
NF_SHARE_PTR<NFIObject> pObejct = m_pKernelModule->GetObject(xGuild);
if (!pObejct.get())
{
if (m_pObjectSaveModule->LoadDataFormNoSql(xGuild, "Guild"))
{
m_pKernelModule->CreateObject(xGuild, 1, 0, "Guild", "", NFCDataList());
}
}
}
示例11: assert
bool NFCProxyServerToWorldModule::AfterInit()
{
m_pEventProcessModule = pPluginManager->FindModule<NFIEventProcessModule>("NFCEventProcessModule");
m_pProxyLogicModule = dynamic_cast<NFIProxyLogicModule*>(pPluginManager->FindModule("NFCProxyLogicModule"));
m_pKernelModule = pPluginManager->FindModule<NFIKernelModule>("NFCKernelModule");
m_pProxyServerNet_ServerModule = dynamic_cast<NFIProxyServerNet_ServerModule*>(pPluginManager->FindModule("NFCProxyServerNet_ServerModule"));
m_pElementInfoModule = pPluginManager->FindModule<NFIElementInfoModule>("NFCElementInfoModule");
m_pLogModule = pPluginManager->FindModule<NFILogModule>("NFCLogModule");
m_pLogicClassModule = pPluginManager->FindModule<NFILogicClassModule>("NFCLogicClassModule");
m_pToGameServerClusterClient = dynamic_cast<NFIClusterClientModule*>(pPluginManager->FindModule("NFCProxyServerToGameModule"));
assert(NULL != m_pEventProcessModule);
assert(NULL != m_pProxyLogicModule);
assert(NULL != m_pKernelModule);
assert(NULL != m_pProxyServerNet_ServerModule);
assert(NULL != m_pElementInfoModule);
assert(NULL != m_pLogModule);
assert(NULL != m_pLogicClassModule);
assert(NULL != m_pToGameServerClusterClient);
NFIClusterClientModule::Bind(this, &NFCProxyServerToWorldModule::OnReciveWSPack, &NFCProxyServerToWorldModule::OnSocketWSEvent);
NF_SHARE_PTR<NFILogicClass> xLogicClass = m_pLogicClassModule->GetElement("Server");
if (xLogicClass.get())
{
NFList<std::string>& xNameList = xLogicClass->GetConfigNameList();
std::string strConfigName;
for (bool bRet = xNameList.First(strConfigName); bRet; bRet = xNameList.Next(strConfigName))
{
const int nServerType = m_pElementInfoModule->GetPropertyInt(strConfigName, "Type");
const int nServerID = m_pElementInfoModule->GetPropertyInt(strConfigName, "ServerID");
if (nServerType == NF_SERVER_TYPES::NF_ST_WORLD)
{
const int nPort = m_pElementInfoModule->GetPropertyInt(strConfigName, "Port");
const int nMaxConnect = m_pElementInfoModule->GetPropertyInt(strConfigName, "MaxOnline");
const int nCpus = m_pElementInfoModule->GetPropertyInt(strConfigName, "CpuCount");
const std::string& strName = m_pElementInfoModule->GetPropertyString(strConfigName, "Name");
const std::string& strIP = m_pElementInfoModule->GetPropertyString(strConfigName, "IP");
ConnectData xServerData;
xServerData.nGameID = nServerID;
xServerData.eServerType = (NF_SERVER_TYPE)nServerType;
xServerData.strIP = strIP;
xServerData.nPort = nPort;
xServerData.strName = strName;
NFIClusterClientModule::AddServer(xServerData);
}
}
}
return true;
}
示例12: SetPlayerRoomID
bool NFCPVPMatchRedisModule::SetPlayerRoomID(const NFGUID& self, const NFGUID& xRoomID)
{
NF_SHARE_PTR<NFINoSqlDriver> pNoSqlDriver = m_pNoSqlModule->GetDriverBySuitConsistent();
if (pNoSqlDriver)
{
std::string strKey = MakePlayerRoomKey();
return pNoSqlDriver->HSet(strKey, self.ToString(), xRoomID.ToString());
}
return false;
}
示例13: ExistAccount
bool NFCAccountRedisModule::ExistAccount(const std::string & strAccount)
{
std::string strAccountKey = m_pCommonRedisModule->GetAccountCacheKey(strAccount);
NF_SHARE_PTR<NFINoSqlDriver> xNoSqlDriver = m_pNoSqlModule->GetDriverBySuit(strAccount);
if (xNoSqlDriver)
{
return xNoSqlDriver->Exists(strAccountKey);
}
return false;
}
示例14: GetActor
bool NFActorModule::AddComponent(const int nActorIndex, NF_SHARE_PTR<NFIComponent> pComponent)
{
NF_SHARE_PTR<NFIActor> pActor = GetActor(nActorIndex);
if (nullptr != pActor)
{
pActor->AddComponent(pComponent);
return true;
}
return false;
}
示例15: QueryRow
// 获得数据
bool NFCRecord::QueryRow(const int nRow, NFIDataList& varList)
{
if (!ValidRow(nRow))
{
return false;
}
if (!IsUsed(nRow))
{
return false;
}
varList.Clear();
for (int i = 0; i < GetCols(); ++i)
{
NF_SHARE_PTR<NFIDataList::TData> pVar = mtRecordVec.at(GetPos(nRow, i));
if (pVar.get())
{
varList.Append(*pVar);
}
else
{
switch (GetColType(i))
{
case TDATA_INT:
varList.Add(NFINT64(0));
break;
case TDATA_FLOAT:
varList.Add(0.0f);
break;
case TDATA_STRING:
varList.Add(NULL_STR.c_str());
break;
case TDATA_OBJECT:
varList.Add(NFGUID());
break;
default:
return false;
break;
}
}
}
if (varList.GetCount() != GetCols())
{
return false;
}
return true;
}