Skip to content

Commit

Permalink
Merge pull request #59 from ketoo/develop
Browse files Browse the repository at this point in the history
5.2.0
  • Loading branch information
ketoo authored Sep 8, 2017
2 parents a0b0af2 + b6f293a commit a454545
Show file tree
Hide file tree
Showing 190 changed files with 5,161 additions and 4,965 deletions.
6 changes: 5 additions & 1 deletion Dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
add_subdirectory(Theron)
add_subdirectory(protobuf)
add_subdirectory(redis-cplusplus-client/msvc/anet_win32)
IF( WIN32 )
add_subdirectory(redis-cplusplus-client/msvc/anet_win32)
ELSE()
add_subdirectory(redis-cplusplus-client)
ENDIF()
add_subdirectory(navigation)
#add_subdirectory(libevent)
2 changes: 1 addition & 1 deletion Dependencies/Theron/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ IF( WIN32 )
LIBRARY_OUTPUT_DIRECTORY ${NFOutPutDir} )
add_definitions(-DTHERON_USE_STD_THREADS -D_X64)
ELSE()
message("not win32")
message("win32_theron not win32")
ENDIF()
2 changes: 1 addition & 1 deletion Dependencies/common/crc32.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace NFrame

static uint32_t CRC32(char* c, int len)
{
register uint32_t crc;
uint32_t crc;
char *e = c + len;

crc = 0xFFFFFFFF;
Expand Down
16 changes: 16 additions & 0 deletions Dependencies/redis-cplusplus-client/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

set(ProjectName "redisclient")
file(GLOB NFRedis_ROOT_C *.c)
file(GLOB NFRedis_ROOT_Hpp *.h)

add_library(redisclient
${NFRedis_ROOT_C}
${NFRedis_ROOT_Hpp})

set_target_properties( redisclient PROPERTIES OUTPUT_NAME_DEBUG "redisclient_d")
set_target_properties( redisclient PROPERTIES PREFIX "")
set_target_properties( redisclient PROPERTIES
FOLDER "NFDeps"
ARCHIVE_OUTPUT_DIRECTORY ${NFOutPutDir}
RUNTIME_OUTPUT_DIRECTORY ${NFOutPutDir}
LIBRARY_OUTPUT_DIRECTORY ${NFOutPutDir} )
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ IF( WIN32 )
RUNTIME_OUTPUT_DIRECTORY ${NFOutPutDir}
LIBRARY_OUTPUT_DIRECTORY ${NFOutPutDir} )
ELSE()
message("not win32")
message("win32_anet_win64 not win32")
ENDIF()

2 changes: 1 addition & 1 deletion NFComm/NFConfigPlugin/NFCElementModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ bool NFCElementModule::CheckRef()
const std::string& strId = strIdList[i];

const std::string& strRefValue= this->GetPropertyString(strId, pProperty->GetKey());
if (!this->GetElement(strRefValue))
if (!strRefValue.empty() && !this->GetElement(strRefValue))
{
std::string msg;
msg.append("check ref failed id: ").append(strRefValue).append(" in ").append(pLogicClass->GetClassName());
Expand Down
10 changes: 10 additions & 0 deletions NFComm/NFCore/NFCObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,16 @@ NF_SHARE_PTR<NFIPropertyManager> NFCObject::GetPropertyManager()
return m_pPropertyManager;
}

void NFCObject::SetRecordManager(NF_SHARE_PTR<NFIRecordManager> xRecordManager)
{
m_pRecordManager = xRecordManager;
}

void NFCObject::SetPropertyManager(NF_SHARE_PTR<NFIPropertyManager> xPropertyManager)
{
m_pPropertyManager = xPropertyManager;
}

NFGUID NFCObject::Self()
{
return mSelf;
Expand Down
3 changes: 3 additions & 0 deletions NFComm/NFCore/NFCObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ class _NFExport NFCObject
virtual NF_SHARE_PTR<NFIRecordManager> GetRecordManager();
virtual NF_SHARE_PTR<NFIPropertyManager> GetPropertyManager();

virtual void SetRecordManager(NF_SHARE_PTR<NFIRecordManager> xRecordManager);
virtual void SetPropertyManager(NF_SHARE_PTR<NFIPropertyManager> xPropertyManager);

protected:
virtual bool AddRecordCallBack(const std::string& strRecordName, const RECORD_EVENT_FUNCTOR_PTR& cb);

Expand Down
62 changes: 7 additions & 55 deletions NFComm/NFCore/NFCProperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ NFCProperty::~NFCProperty()

void NFCProperty::SetValue(const NFData& xData)
{
if (eType != xData.GetType())
if (eType != xData.GetType()
|| xData.GetType() == NFDATA_TYPE::TDATA_UNKNOWN)
{
return;
}
Expand Down Expand Up @@ -251,12 +252,12 @@ int NFCProperty::OnEventHandler(const NFData& oldVar, const NFData& newVar)

TPROPERTYCALLBACKEX::iterator it = mtPropertyCallback.begin();
TPROPERTYCALLBACKEX::iterator end = mtPropertyCallback.end();
for (it; it != end; ++it)
for (; it != end; ++it)
{

PROPERTY_EVENT_FUNCTOR_PTR& pFunPtr = *it;
PROPERTY_EVENT_FUNCTOR* pFunc = pFunPtr.get();
int nTemRet = pFunc->operator()(mSelf, msPropertyName, oldVar, newVar);
pFunc->operator()(mSelf, msPropertyName, oldVar, newVar);
}

return 0;
Expand Down Expand Up @@ -562,61 +563,12 @@ std::string NFCProperty::ToString()

bool NFCProperty::FromString(const std::string& strData)
{
const NFDATA_TYPE eType = GetType();
bool bRet = false;
switch (eType)
{
case TDATA_INT:
{
NFINT64 nValue = 0;
bRet = NF_StrTo(strData, nValue);
SetInt(nValue);
}
break;

case TDATA_FLOAT:
{
double dValue = 0;
bRet = NF_StrTo(strData, dValue);
SetFloat(dValue);
}
break;

case TDATA_STRING:
{
SetString(strData);
bRet = true;
}
break;
case TDATA_OBJECT:
{
NFGUID xID;

bRet = xID.FromString(strData);
SetObject(xID);
}
break;
case TDATA_VECTOR2:
{
NFVector2 xVector2;

bRet = xVector2.FromString(strData);
SetVector2(xVector2);
}
break;
case TDATA_VECTOR3:
if (!mxData)
{
NFVector3 xVector3;

bRet = xVector3.FromString(strData);
SetVector3(xVector3);
}
break;
default:
break;
mxData = NF_SHARE_PTR<NFData>(NF_NEW NFData(GetType()));
}

return bRet;
return mxData->FromString(strData);
}

bool NFCProperty::DeSerialization()
Expand Down
62 changes: 59 additions & 3 deletions NFComm/NFCore/NFDataList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ struct NFData
return NULL_VECTOR3;
}

std::string StringValEx() const
std::string ToString() const
{
std::string strData;

Expand Down Expand Up @@ -426,6 +426,62 @@ struct NFData
return strData;
}

bool FromString(const std::string& strData)
{
try
{
switch (nType)
{
case TDATA_INT:
SetInt(lexical_cast<int64_t> (strData));
break;

case TDATA_FLOAT:
SetFloat(lexical_cast<float> (strData));
break;

case TDATA_STRING:
SetString(strData);
break;

case TDATA_OBJECT:
{
NFGUID xID;
xID.FromString(strData);
SetObject(xID);
}
break;

case TDATA_VECTOR2:
{
NFVector2 v;
v.FromString(strData);
SetVector2(v);
}
break;

case TDATA_VECTOR3:
{
NFVector3 v;
v.FromString(strData);
SetVector3(v);
}
break;

default:
break;
}

return true;
}
catch (...)
{
return false;
}

return false;
}

private:

NFDATA_TYPE nType;
Expand All @@ -452,7 +508,7 @@ class NFDataList :public NFMemoryCounter<NFDataList>
{
}

virtual std::string StringValEx(const int index) const
virtual std::string ToString(const int index) const
{

if (ValidIndex(index))
Expand Down Expand Up @@ -499,7 +555,7 @@ class NFDataList :public NFMemoryCounter<NFDataList>
{
for (int i = 0; i < GetCount(); ++i)
{
std::string strVal = StringValEx(i);
std::string strVal = ToString(i);
str += strVal;
str += strSplit;
}
Expand Down
Loading

0 comments on commit a454545

Please sign in to comment.