本文整理汇总了C++中NF_SHARE_PTR::First方法的典型用法代码示例。如果您正苦于以下问题:C++ NF_SHARE_PTR::First方法的具体用法?C++ NF_SHARE_PTR::First怎么用?C++ NF_SHARE_PTR::First使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NF_SHARE_PTR
的用法示例。
在下文中一共展示了NF_SHARE_PTR::First方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TrailObjectData
int NFCPropertyTrailModule::TrailObjectData(const NFGUID& self)
{
NF_SHARE_PTR<NFIObject> xObject = m_pKernelModule->GetObject(self);
if (nullptr == xObject)
{
return -1;
}
NF_SHARE_PTR<NFIPropertyManager> xPropertyManager = xObject->GetPropertyManager();
if (nullptr != xPropertyManager)
{
NF_SHARE_PTR<NFIProperty> xProperty = xPropertyManager->First();
while (nullptr != xProperty)
{
m_pKernelModule->AddPropertyCallBack(self, xProperty->GetKey(), this, &NFCPropertyTrailModule::OnObjectPropertyEvent);
xProperty = xPropertyManager->Next();
}
}
NF_SHARE_PTR<NFIRecordManager> xRecordManager = xObject->GetRecordManager();
if (nullptr != xRecordManager)
{
NF_SHARE_PTR<NFIRecord> xRecord = xRecordManager->First();
while (nullptr != xRecord)
{
m_pKernelModule->AddRecordCallBack(self, xRecord->GetName(), this, &NFCPropertyTrailModule::OnObjectRecordEvent);
xRecord = xRecordManager->Next();
}
}
return 0;
}
示例2: LogObjectData
int NFCPropertyTrailModule::LogObjectData(const NFGUID& self)
{
NF_SHARE_PTR<NFIObject> xObject = m_pKernelModule->GetObject(self);
if (nullptr == xObject)
{
return -1;
}
NF_SHARE_PTR<NFIPropertyManager> xPropertyManager = xObject->GetPropertyManager();
if (nullptr != xPropertyManager)
{
NF_SHARE_PTR<NFIProperty> xProperty = xPropertyManager->First();
while (nullptr != xProperty)
{
std::ostringstream stream;
stream << " Start trail ";
stream << xProperty->ToString();
m_pLogModule->LogProperty(NFILogModule::NF_LOG_LEVEL::NLL_INFO_NORMAL, self, xProperty->GetKey(), stream.str(), __FUNCTION__, __LINE__);
xProperty = xPropertyManager->Next();
}
}
NF_SHARE_PTR<NFIRecordManager> xRecordManager = xObject->GetRecordManager();
if (nullptr != xRecordManager)
{
NF_SHARE_PTR<NFIRecord> xRecord = xRecordManager->First();
while (nullptr != xRecord)
{
for (int i = 0; i < xRecord->GetRows(); ++i)
{
NFCDataList xDataList;
bool bRet = xRecord->QueryRow(i, xDataList);
if (bRet)
{
std::ostringstream stream;
stream << " Start trail Row[" << i << "]";
for (int j = 0; j < xDataList.GetCount(); ++j)
{
stream << " [" << j << "] " << xDataList.StringValEx(j);
}
m_pLogModule->LogRecord(NFILogModule::NF_LOG_LEVEL::NLL_INFO_NORMAL, self, xRecord->GetName(), stream.str(), __FUNCTION__, __LINE__);
}
}
xRecord = xRecordManager->Next();
}
}
return 0;
}
示例3: pRecordManager
NF_SHARE_PTR<NFIRecordManager> NFCCommonRedisModule::NewRecordManager(const std::string& strClassName)
{
NF_SHARE_PTR<NFIRecordManager> pStaticClassRecordManager = m_pLogicClassModule->GetClassRecordManager(strClassName);
if (pStaticClassRecordManager)
{
NFGUID ident;
NF_SHARE_PTR<NFIRecordManager> pRecordManager(NF_NEW NFCRecordManager(ident));
NF_SHARE_PTR<NFIRecord> pConfigRecordInfo = pStaticClassRecordManager->First();
while (pConfigRecordInfo)
{
if (pConfigRecordInfo->GetSave() || pConfigRecordInfo->GetCache())
{
NF_SHARE_PTR<NFIRecord> xRecord = pRecordManager->AddRecord(ident,
pConfigRecordInfo->GetName(),
pConfigRecordInfo->GetInitData(),
pConfigRecordInfo->GetTag(),
pConfigRecordInfo->GetRows());
xRecord->SetPublic(pConfigRecordInfo->GetPublic());
xRecord->SetPrivate(pConfigRecordInfo->GetPrivate());
xRecord->SetSave(pConfigRecordInfo->GetSave());
xRecord->SetCache(pConfigRecordInfo->GetCache());
}
pConfigRecordInfo = pStaticClassRecordManager->Next();
}
return pRecordManager;
}
return NF_SHARE_PTR<NFIRecordManager>(NULL);
}
示例4: pPropertyManager
NF_SHARE_PTR<NFIPropertyManager> NFCCommonRedisModule::NewPropertyManager(const std::string& strClassName)
{
NF_SHARE_PTR<NFIPropertyManager> pStaticClassPropertyManager = m_pLogicClassModule->GetClassPropertyManager(strClassName);
if (pStaticClassPropertyManager)
{
NFGUID ident;
NF_SHARE_PTR<NFIPropertyManager> pPropertyManager(NF_NEW NFCPropertyManager(ident));
NF_SHARE_PTR<NFIProperty> pStaticConfigPropertyInfo = pStaticClassPropertyManager->First();
while (pStaticConfigPropertyInfo)
{
if (pStaticConfigPropertyInfo->GetSave() || pStaticConfigPropertyInfo->GetCache())
{
NF_SHARE_PTR<NFIProperty> xProperty = pPropertyManager->AddProperty(ident, pStaticConfigPropertyInfo->GetKey(), pStaticConfigPropertyInfo->GetType());
xProperty->SetPublic(pStaticConfigPropertyInfo->GetPublic());
xProperty->SetPrivate(pStaticConfigPropertyInfo->GetPrivate());
xProperty->SetSave(pStaticConfigPropertyInfo->GetSave());
xProperty->SetCache(pStaticConfigPropertyInfo->GetCache());
xProperty->SetRef(pStaticConfigPropertyInfo->GetRef());
}
pStaticConfigPropertyInfo = pStaticClassPropertyManager->Next();
}
return pPropertyManager;
}
return NF_SHARE_PTR<NFIPropertyManager>(NULL);
}
示例5: ConvertRecordManagerToVector
bool NFCCommonRedisModule::ConvertRecordManagerToVector(NF_SHARE_PTR<NFIRecordManager> pRecordManager, std::vector<std::string>& vKeyList, std::vector<std::string>& vValueList)
{
for (NF_SHARE_PTR<NFIRecord> pRecord = pRecordManager->First(); pRecord != NULL; pRecord = pRecordManager->Next())
{
if (!pRecord->GetCache() && !pRecord->GetSave())
{
continue;
}
NFMsg::ObjectRecordBase xRecordData;
ConvertRecordToPB(pRecord, &xRecordData);
////
std::string strValue;
if (!xRecordData.SerializeToString(&strValue))
{
continue;
}
vKeyList.push_back(xRecordData.record_name());
vValueList.push_back(strValue);
}
return true;
}
示例6: ConvertRecordManagerToPB
bool NFCCreateRoleModule::ConvertRecordManagerToPB(const NF_SHARE_PTR<NFIRecordManager>& pRecordManager, NFMsg::ObjectRecordList * pRecordDataList)
{
if (pRecordDataList == nullptr)
{
return false;
}
for (NF_SHARE_PTR<NFIRecord> pRecord = pRecordManager->First(); pRecord != NULL; pRecord = pRecordManager->Next())
{
if (!pRecord->GetCache() && !pRecord->GetSave())
{
continue;
}
NFMsg::ObjectRecordBase* pRecordData = pRecordDataList->add_record_list();
if (!pRecordData)
{
continue;
}
ConvertRecordToPB(pRecord, pRecordData);
}
return true;
}
示例7: CreateContinerObjectByFile
bool NFCSceneProcessModule::CreateContinerObjectByFile( const int nContainerID, const int nGroupID, const std::string& strFileName )
{
NF_SHARE_PTR<NFMapEx<std::string, SceneGroupResource>> pSceneResource = mtSceneResourceConfig.GetElement( nContainerID );
if ( pSceneResource.get() )
{
NF_SHARE_PTR<SceneGroupResource> pResourceMap = pSceneResource->GetElement( strFileName );
if ( pResourceMap.get() )
{
NF_SHARE_PTR<NFMapEx<std::string, SceneSeedResource>> pNPCResourceList = pResourceMap->xSceneGroupResource.GetElement( "NPC" );
if ( pNPCResourceList.get() )
{
NF_SHARE_PTR<SceneSeedResource> pResource = pNPCResourceList->First( );
while ( pResource.get() )
{
CreateContinerObject( nContainerID, nGroupID, strFileName, pResource->strSeedID );
pResource = pNPCResourceList->Next();
}
}
}
}
return true;
}
示例8:
std::vector<std::string> NFCCommonConfigModule::GetSubKeyList(const std::string&strStructName)
{
std::vector<std::string> xList;
NF_SHARE_PTR<CStructInfo> pStructTypeData = mmData.GetElement(strStructName);
if (pStructTypeData)
{
std::string strStructName;
for (NF_SHARE_PTR<CAttributeList> pData = pStructTypeData->First(strStructName); pData != NULL; pData = pStructTypeData->Next(strStructName))
{
xList.push_back(strStructName);
}
}
return xList;
}
示例9: AddItemEffectDataProperty
int NFCItemModule::AddItemEffectDataProperty(const NFGUID& self, const NFGUID& xTarget, const std::string& strItemID)
{
if (strItemID.empty())
{
return 1;
}
//////////////////////////////////////////////////////////////////////////
NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->GetObject(xTarget);
if (NULL == pObject)
{
//m_pLogModule->LogObject(NFILogModule::NLL_ERROR_NORMAL, self, "There is no object", __FUNCTION__, __LINE__);
return 1;
}
//////////////////////////////////////////////////////////////////////////
NF_SHARE_PTR<NFIPropertyManager> pPropertyManager = m_pElementModule->GetPropertyManager(strItemID);
if (!pPropertyManager)
{
return 1;
}
NF_SHARE_PTR<NFIProperty> pEffectDataProperty = pPropertyManager->GetElement("EffectData");
if (!pEffectDataProperty)
{
return 1;
}
NF_SHARE_PTR<NFIPropertyManager> pEffectDataPropertyManager = m_pElementModule->GetPropertyManager(pEffectDataProperty->GetString());
if (!pEffectDataPropertyManager)
{
return 1;
}
NF_SHARE_PTR<NFIProperty> pProperty = pEffectDataPropertyManager->First();
while (pProperty)
{
if (pProperty->GetInt() != 0)
{
m_pPropertyModule->AddPropertyValue(xTarget, pProperty->GetKey(), NFIPropertyModule::NPG_EQUIP, pProperty->GetInt());
}
pProperty = pEffectDataPropertyManager->Next();
}
return 0;
}
示例10: DoEvent
bool NFCEventProcessModule::DoEvent(const NFIDENTID& objectID, const std::string& strClassName, const CLASS_OBJECT_EVENT eClassEvent, const NFIDataList& valueList, const bool bSync)
{
NF_SHARE_PTR<NFCClassEventList> pEventList = mxClassEventInfoEx.GetElement(strClassName);
if (nullptr != pEventList)
{
CLASS_EVENT_FUNCTOR_PTR cb;
bool bRet = pEventList->First(cb);
while (bRet)
{
cb.get()->operator()(objectID, strClassName, eClassEvent, valueList);
bRet = pEventList->Next(cb);
}
}
return false;
}
示例11: NewPropertyManager
NF_SHARE_PTR<NFIPropertyManager> NFCCommonRedisModule::GetPropertyInfo(const NFGUID& self, const std::string& strClassName, std::vector<std::string>& vKeyCacheList, std::vector<std::string>& vValueCacheList)
{
//TODO optimize
NF_SHARE_PTR<NFIPropertyManager> pPropertyManager = NewPropertyManager(strClassName);
if (!pPropertyManager)
{
return nullptr;
}
NF_SHARE_PTR<NFIRedisClient> pDriver = m_pNoSqlModule->GetDriverBySuit(self.ToString());
if (!pDriver)
{
return nullptr;
}
//TODO
//just run this function one time
NF_SHARE_PTR<NFIProperty> xProperty = pPropertyManager->First();
while (xProperty)
{
if (xProperty->GetCache() || xProperty->GetSave())
{
vKeyCacheList.push_back(xProperty->GetKey());
}
xProperty = pPropertyManager->Next();
}
//cache
std::string strCacheKey = GetPropertyCacheKey(self);
if (!pDriver->HMGET(strCacheKey, vKeyCacheList, vValueCacheList))
{
return nullptr;
}
if (vKeyCacheList.size() == vValueCacheList.size())
{
ConvertVectorToPropertyManager(vKeyCacheList, vValueCacheList, pPropertyManager);
return pPropertyManager;
}
return nullptr;
}
示例12: NewRecordManager
NF_SHARE_PTR<NFIRecordManager> NFCCommonRedisModule::GetRecordInfo(const NFGUID& self, const std::string& strClassName, std::vector<std::string>& vKeyCacheList, std::vector<std::string>& vValueCacheList)
{
NF_SHARE_PTR<NFIRecordManager> pRecordManager = NewRecordManager(strClassName);
if (!pRecordManager.get())
{
return nullptr;
}
NF_SHARE_PTR<NFIRedisClient> pDriver = m_pNoSqlModule->GetDriverBySuit(self.ToString());
if (!pDriver)
{
return nullptr;
}
//TODO
//just run this function one time
NF_SHARE_PTR<NFIRecord> xRecord = pRecordManager->First();
while (xRecord)
{
if (xRecord->GetCache() || xRecord->GetSave())
{
vKeyCacheList.push_back(xRecord->GetName());
}
xRecord = pRecordManager->Next();
}
//cache
std::string strCacheKey = GetRecordCacheKey(self);
if (!pDriver->HMGET(strCacheKey, vKeyCacheList, vValueCacheList))
{
return nullptr;
}
if (vKeyCacheList.size() == vValueCacheList.size())
{
ConvertVectorToRecordManager(vKeyCacheList, vValueCacheList, pRecordManager);
return pRecordManager;
}
return nullptr;
}
示例13: ConvertPropertyManagerToVector
bool NFCCommonRedisModule::ConvertPropertyManagerToVector(NF_SHARE_PTR<NFIPropertyManager> pPropertyManager, std::vector<std::string>& vKeyList, std::vector<std::string>& vValueList)
{
for (NF_SHARE_PTR<NFIProperty> pProperty = pPropertyManager->First(); pProperty != NULL; pProperty = pPropertyManager->Next())
{
const int nType = pProperty->GetType();
if (!pProperty->GetCache() && !pProperty->GetSave())
{
continue;
}
const std::string& strPropertyName = pProperty->GetKey();
const std::string& strPropertyValue = pProperty->ToString();
vKeyList.push_back(strPropertyName);
vValueList.push_back(strPropertyValue);
}
return true;
}
示例14: Execute
bool NFCEventProcessModule::Execute(const float fLasFrametime, const float fStartedTime)
{
NFIDENTID ident;
NF_SHARE_PTR<NFList<int>> pList = mRemoveEventListEx.First(ident);
while (nullptr != pList)
{
//删除对象的某个事�?
NF_SHARE_PTR<NFCObjectEventInfo> pObjectEventInfo = mObjectEventInfoMapEx.GetElement(ident);
if (pObjectEventInfo)
{
int nEvent = 0;
bool bRet = pList->First(nEvent);
while (bRet)
{
pObjectEventInfo->RemoveElement(nEvent);
bRet = pList->Next(nEvent);
}
}
pList = NULL;
pList = mRemoveEventListEx.Next();
}
mRemoveEventListEx.ClearAll();
//////////////////////////////////////////////////////////////////////////
//删除事件对象
bool bRet = mRemoveObjectListEx.First(ident);
while (bRet)
{
mObjectEventInfoMapEx.RemoveElement(ident);
bRet = mRemoveObjectListEx.Next(ident);
}
mRemoveObjectListEx.ClearAll();
return true;
}
示例15: AddClass
bool NFCClassModule::AddClass(const char* pstrClassFilePath, NF_SHARE_PTR<NFIClass> pClass)
{
NF_SHARE_PTR<NFIClass> pParent = pClass->GetParent();
while (pParent)
{
//inherited some properties form class of parent
std::string strFileName = "";
pParent->First(strFileName);
while (!strFileName.empty())
{
if (pClass->Find(strFileName))
{
strFileName.clear();
continue;
}
if (AddClassInclude(strFileName.c_str(), pClass))
{
pClass->Add(strFileName);
}
strFileName.clear();
pParent->Next(strFileName);
}
pParent = pParent->GetParent();
}
//////////////////////////////////////////////////////////////////////////
if (AddClassInclude(pstrClassFilePath, pClass))
{
pClass->Add(pstrClassFilePath);
}
//file.close();
return true;
}