SNetObjectID

C++
struct SNetObjectID {
  const uint16 InvalidId = ~uint16(0);
  uint16 id;
  uint16 salt;
  enum ESerializationTarget {
    eST_SaveGame,
    eST_Network,
    eST_Script
  };
  struct ISerializeUpdateFunction {
  };
  template <class F_Update>
class CSerializeUpdateFunction : public ISerializeUpdateFunction;
  struct SSerializeString {
  };
  struct ISerialize {
    const int ENUM_POLICY_TAG = 0xe0000000;
  };
  template <class TISerialize>
class CSerializeWrapper;
  struct ISerializable {
  };
  struct SSerializeScopedBeginGroup {
  };
};
File

ISerialize.h

Description

Unfortunately this needs to be here - should be in CryNetwork somewhere.

SNetObjectID::CSerializeUpdateFunction Template
Class Hierarchy
C++
template <class F_Update>
class CSerializeUpdateFunction : public ISerializeUpdateFunction;
File

ISerialize.h

Description

concrete implementation of IUpdateFunction for a general functor class

SNetObjectID::CSerializeUpdateFunction::CSerializeUpdateFunction Constructor
C++
CSerializeUpdateFunction(F_Update& update);
SNetObjectID::CSerializeUpdateFunction::Execute Method
C++
virtual void Execute();
SNetObjectID::CSerializeWrapper Template
Class Hierarchy
C++
template <class TISerialize>
class CSerializeWrapper;
File

ISerialize.h

Description

this class provides a wrapper so that ISerialize can be used much more easily; it is a template so that if we need to wrap a more specific ISerialize implementation we can do so easily

SNetObjectID::CSerializeWrapper::BeginGroup Method
C++
void BeginGroup(const char * szName);
Description

// we can request that a functor be called whenever our values // are being updated by calling this function template

SNetObjectID::CSerializeWrapper::BeginOptionalGroup Method
C++
bool BeginOptionalGroup(const char * szName, bool condition);
SNetObjectID::CSerializeWrapper::CONTAINER_VALUE Method (VectorSet, insert)
C++
CONTAINER_VALUE(VectorSet, insert);
SNetObjectID::CSerializeWrapper::CONTAINER_VALUE Method (std::deque, push_back)
C++
CONTAINER_VALUE(std::deque, push_back);
SNetObjectID::CSerializeWrapper::CONTAINER_VALUE Method (std::list, push_back)
C++
CONTAINER_VALUE(std::list, push_back);
SNetObjectID::CSerializeWrapper::CONTAINER_VALUE Method (std::set, insert)
C++
CONTAINER_VALUE(std::set, insert);
SNetObjectID::CSerializeWrapper::CONTAINER_VALUE Method (std::vector, push_back)
C++
CONTAINER_VALUE(std::vector, push_back);
SNetObjectID::CSerializeWrapper::CSerializeWrapper Constructor
C++
CSerializeWrapper(TISerialize * pSerialize);
SNetObjectID::CSerializeWrapper::DummyValues Method
C++
template <typename T_Value> void DummyValues(uint32 numDummyValues);
SNetObjectID::CSerializeWrapper::EndGroup Method
C++
void EndGroup();
SNetObjectID::CSerializeWrapper::EnumValue Method (char *, T_Class *, T_Value (T_Class::*GetValue)() const, void (T_Class::*SetValue)(T_Value), T_Value, T_Value)
C++
template <typename T_Value, class T_Class> void EnumValue(const char * szName, T_Class * pClass, T_Value (T_Class::*GetValue)() const, void (T_Class::*SetValue)(T_Value), T_Value first, T_Value last);
SNetObjectID::CSerializeWrapper::EnumValue Method (char *, T_Value&, T_Value, T_Value)
C++
template <typename T_Value> void EnumValue(const char * szName, T_Value& value, T_Value first, T_Value last);
SNetObjectID::CSerializeWrapper::GetSerializationTarget Method
C++
ESerializationTarget GetSerializationTarget() const;
Description

fetch the serialization target

SNetObjectID::CSerializeWrapper::HASH_CONTAINER_VALUE Method
C++
HASH_CONTAINER_VALUE(stl::hash_map);
SNetObjectID::CSerializeWrapper::IsReading Method
C++
bool IsReading() const;
SNetObjectID::CSerializeWrapper::IsWriting Method
C++
bool IsWriting() const;
SNetObjectID::CSerializeWrapper::MAP_CONTAINER_VALUE Method (VectorMap)
C++
MAP_CONTAINER_VALUE(VectorMap);
SNetObjectID::CSerializeWrapper::MAP_CONTAINER_VALUE Method (std::map)
C++
MAP_CONTAINER_VALUE(std::map);
SNetObjectID::CSerializeWrapper::MAP_CONTAINER_VALUE Method (std::multimap)
C++
MAP_CONTAINER_VALUE(std::multimap);
SNetObjectID::CSerializeWrapper::MappedValue Method (char *, MiniQueue&, T_Map&)
C++
template <typename T_Value, uint8 N, class T_Map> void MappedValue(const char * name, MiniQueue& cont, const T_Map& mapper);
SNetObjectID::CSerializeWrapper::MappedValue Method (char *, T_Key&, T_Map&)
C++
template <class T_Key, class T_Map> void MappedValue(const char * szName, T_Key& value, const T_Map& mapper);
Description

a value that is written by referring to a map of key/value pairs - we receive the key, and write the value

SNetObjectID::CSerializeWrapper::Ok Method
C++
bool Ok() const;
SNetObjectID::CSerializeWrapper::PAIR_CONTAINER_VALUE Method (std::list, push_back)
C++
PAIR_CONTAINER_VALUE(std::list, push_back);
SNetObjectID::CSerializeWrapper::PAIR_CONTAINER_VALUE Method (std::vector, push_back)
C++
PAIR_CONTAINER_VALUE(std::vector, push_back);
SNetObjectID::CSerializeWrapper::ShouldCommitValues Method
C++
bool ShouldCommitValues() const;
SNetObjectID::CSerializeWrapper::Value Method (char *, CountedValue&)
C++
template <class T> void Value(const char * name, CountedValue& countedValue);
SNetObjectID::CSerializeWrapper::Value Method (char *, CountedValue&, int)
C++
template <class T> void Value(const char * name, CountedValue& countedValue, int policy);
SNetObjectID::CSerializeWrapper::Value Method (char *, CryStringLocalT&)
C++
template <typename T> void Value(const char * szName, const CryStringLocalT& value);
SNetObjectID::CSerializeWrapper::Value Method (char *, CryStringLocalT&, int)
C++
template <typename T> void Value(const char * szName, const CryStringLocalT& value, int policy);
SNetObjectID::CSerializeWrapper::Value Method (char *, IScriptTable *)
C++
void Value(const char * name, IScriptTable * pTable);
SNetObjectID::CSerializeWrapper::Value Method (char *, MiniQueue&)
C++
template <typename T_Value, uint8 N> void Value(const char * name, MiniQueue& cont);
SNetObjectID::CSerializeWrapper::Value Method (char *, SmartScriptTable&)
C++
void Value(const char * name, SmartScriptTable& pTable);
SNetObjectID::CSerializeWrapper::Value Method (char *, T_Class *, T_Value (T_Class::*get)() const, void (T_Class::*set)(T_Value))
C++
template <class T_Class, typename T_Value> void Value(const char * szName, T_Class * pInst, T_Value (T_Class::*get)() const, void (T_Class::*set)(T_Value));
SNetObjectID::CSerializeWrapper::Value Method (char *, T_Class *, T_Value (T_Class::*get)() const, void (T_Class::*set)(T_Value), T_SerializationPolicy&)
C++
template <class T_Class, typename T_Value, class T_SerializationPolicy> void Value(const char * szName, T_Class * pInst, T_Value (T_Class::*get)() const, void (T_Class::*set)(T_Value), const T_SerializationPolicy& policy);
SNetObjectID::CSerializeWrapper::Value Method (char *, T_Value&)
C++
template <typename T_Value> void Value(const char * szName, T_Value& value);
SNetObjectID::CSerializeWrapper::Value Method (char *, T_Value&, int)
C++
template <typename T_Value> void Value(const char * szName, T_Value& value, int policy);
Description

the value function allows us to declare that a value needs to be serialized/deserialized; we can pass a serialization policy in order to compress the value, and an update function to allow us to be informed of when this value is changed

SNetObjectID::CSerializeWrapper::Value Method (char *, string&)
C++
void Value(const char * szName, const string& value);
SNetObjectID::CSerializeWrapper::Value Method (char *, string&, int)
C++
void Value(const char * szName, const string& value, int policy);
SNetObjectID::CSerializeWrapper::Value Method (char*, CryFixedStringT &)
C++
template  void Value(const char* szName, CryFixedStringT & value);
SNetObjectID::CSerializeWrapper::Value Method (char*, CryFixedStringT &, int)
C++
template  void Value(const char* szName, CryFixedStringT & value, int policy);
SNetObjectID::CSerializeWrapper::Value Method (char*, InterpolatedValue_tpl&)
C++
template <class T, class TT> void Value(const char* name, InterpolatedValue_tpl& val);
SNetObjectID::CSerializeWrapper::Value Method (char*, InterpolatedValue_tpl&, int)
C++
template <class T, class TT> void Value(const char* name, InterpolatedValue_tpl& val, int policy);
SNetObjectID::CSerializeWrapper::ValueChar Method
C++
bool ValueChar(const char * name, char * buffer, int len);
SNetObjectID::CSerializeWrapper::ValueWithDefault Method (char *, T&, T &)
C++
template <typename T> void ValueWithDefault(const char * name, T& x, const T & defaultValue);
SNetObjectID::CSerializeWrapper::ValueWithDefault Method (char *, string&, string&)
C++
void ValueWithDefault(const char * szName, string& value, const string& defaultValue);
friend TISerialize * GetImpl( CSerializeWrapper ser ) { return ser.m_pSerialize; } void FlagPartialRead() { m_pSerialize->FlagPartialRead(); } operator CSerializeWrapper() { return CSerializeWrapper( m_pSerialize ); } SSerializeString& SetSharedSerializeString(const string& str) { ScopedSwitchToGlobalHeap useGlobalHeap; static SSerializeString serializeString; serializeString.set_string(str); return serializeString; } template SSerializeString& SetSharedSerializeString(const CryFixedStringT& str) { ScopedSwitchToGlobalHeap useGlobalHeap; static SSerializeString serializeString; serializeString.set_string(str); return serializeString; } private: TISerialize * m_pSerialize Friend
C++
friend TISerialize * GetImpl( CSerializeWrapper ser ) { return ser.m_pSerialize; } void FlagPartialRead() { m_pSerialize->FlagPartialRead(); } operator CSerializeWrapper<ISerialize>() { return CSerializeWrapper<ISerialize>( m_pSerialize ); } SSerializeString& SetSharedSerializeString(const string& str) { ScopedSwitchToGlobalHeap useGlobalHeap; static SSerializeString serializeString; serializeString.set_string(str); return serializeString; } template SSerializeString& SetSharedSerializeString(const CryFixedStringT& str) { ScopedSwitchToGlobalHeap useGlobalHeap; static SSerializeString serializeString; serializeString.set_string(str); return serializeString; } private: TISerialize * m_pSerialize;
SNetObjectID::ESerializationTarget Enumeration
C++
enum ESerializationTarget {
  eST_SaveGame,
  eST_Network,
  eST_Script
};
File

ISerialize.h

Description

this enumeration details what "kind" of serialization we are performing, so that classes that want to, for instance, tailor the data they present depending on where data is being written to can do so

SNetObjectID::ISerializable Structure
C++
struct ISerializable {
};
File

ISerialize.h

Description

simple struct to declare something serializable... useful for exposition

SNetObjectID::ISerializable::~ISerializable Destructor
C++
virtual ~ISerializable();
SNetObjectID::ISerializable::SerializeWith Method
C++
virtual void SerializeWith(TSerialize) = 0;
SNetObjectID::ISerialize Structure
C++
struct ISerialize {
  const int ENUM_POLICY_TAG = 0xe0000000;
};
File

ISerialize.h

Description

the ISerialize is intended to be implemented by objects that need to read and write from various data sources, in such a way that different tradeoffs can be balanced by the object that is being serialized, and so that objects being serialized need only write a single function in order to be read from and written to

SNetObjectID::ISerialize::ENUM_POLICY_TAG Data Member
C++
const int ENUM_POLICY_TAG = 0xe0000000;
SNetObjectID::ISerialize::~ISerialize Destructor
C++
virtual ~ISerialize();
SNetObjectID::ISerialize::BeginGroup Method
C++
virtual void BeginGroup(const char * szName) = 0;
Description

Begins a serialization group - must be matched by an EndGroup szName is preferably as short as possible for performance reasons Spaces in szName cause undefined behaviour, use alpha characters,underscore and numbers only for a name.

SNetObjectID::ISerialize::BeginOptionalGroup Method
C++
virtual bool BeginOptionalGroup(const char * szName, bool condition) = 0;
SNetObjectID::ISerialize::EndGroup Method
C++
virtual void EndGroup() = 0;
SNetObjectID::ISerialize::FlagPartialRead Method
C++
virtual void FlagPartialRead() = 0;
Description

for network updates: notify the network engine that this value was only partially read and we should re-request an update from the server soon

SNetObjectID::ISerialize::GetSerializationTarget Method
C++
virtual ESerializationTarget GetSerializationTarget() const = 0;
SNetObjectID::ISerialize::ISerialize Constructor
C++
ISerialize();
SNetObjectID::ISerialize::IsReading Method
C++
virtual bool IsReading() const = 0;
SNetObjectID::ISerialize::Ok Method
C++
virtual bool Ok() const = 0;
SNetObjectID::ISerialize::ReadStringValue Method
C++
virtual void ReadStringValue(const char * name, SSerializeString & curValue, uint32 policy = 0) = 0;
Description

this is for string values -- they need special support

SNetObjectID::ISerialize::SERIALIZATION_TYPE Method
C++
SERIALIZATION_TYPE(SSerializeString);
SNetObjectID::ISerialize::ShouldCommitValues Method
C++
virtual bool ShouldCommitValues() const = 0;
SNetObjectID::ISerialize::Update Method
C++
virtual void Update(ISerializeUpdateFunction * pUpdate) = 0;
Description

this function should be implemented to call the passed in interface if we are reading, and to not call it if we are writing

SNetObjectID::ISerialize::Value Method (char *, B&)
C++
template <class B> SERIALIZATION_TYPE void Value(const char * name, B& x);
SNetObjectID::ISerialize::Value Method (char *, B&, uint32)
C++
template <class B> void Value(const char * name, B& x, uint32 policy);
SNetObjectID::ISerialize::ValueWithDefault Method
C++
template <class B> void ValueWithDefault(const char * name, B& x, const B& defaultValue);
Description

Based off ValueWithDefault in SimpleSerialize.h

SNetObjectID::ISerialize::WriteStringValue Method
C++
virtual void WriteStringValue(const char * name, SSerializeString& buffer, uint32 policy = 0) = 0;
SNetObjectID::ISerializeUpdateFunction Structure
C++
struct ISerializeUpdateFunction {
};
File

ISerialize.h

Description

this inner class defines an interface so that OnUpdate functions can be passed abstractly through to concrete serialization classes

SNetObjectID::ISerializeUpdateFunction::~ISerializeUpdateFunction Destructor
C++
SNetObjectID::ISerializeUpdateFunction::Execute Method
C++
virtual void Execute() = 0;
SNetObjectID::SSerializeScopedBeginGroup Structure
C++
struct SSerializeScopedBeginGroup {
};
File

ISerialize.h

Description

Used to automatically Begin/End group in serialization stream

SNetObjectID::SSerializeScopedBeginGroup::~SSerializeScopedBeginGroup Destructor
C++
SNetObjectID::SSerializeScopedBeginGroup::SSerializeScopedBeginGroup Constructor
C++
SSerializeScopedBeginGroup(TSerialize & ser, const char * sGroupName);
SNetObjectID::SSerializeString Structure
C++
struct SSerializeString {
};
File

ISerialize.h

Description

Temporary class for string serialization.

SNetObjectID::SSerializeString::!= Operator
C++
bool operator !=(const SSerializeString & src);
SNetObjectID::SSerializeString::~SSerializeString Destructor
C++
SNetObjectID::SSerializeString::= Operator (SSerializeString &)
C++
SSerializeString& operator =(const SSerializeString & src);
Description

operator const char* () const { return m_str;

SNetObjectID::SSerializeString::= Operator (char *)
C++
SSerializeString& operator =(const char * src);
SNetObjectID::SSerializeString::c_str Method
C++
const char* c_str() const;
SNetObjectID::SSerializeString::const string Operator
C++
operator const string() const;
SNetObjectID::SSerializeString::empty Method
C++
bool empty() const;
SNetObjectID::SSerializeString::length Method
C++
size_t length() const;
SNetObjectID::SSerializeString::reserve Method
C++
void reserve(int sz);
SNetObjectID::SSerializeString::resize Method
C++
void resize(int sz);
SNetObjectID::SSerializeString::set_string Method (CryFixedStringT&)
C++
template  void set_string(const CryFixedStringT& s);
SNetObjectID::SSerializeString::set_string Method (string &)
C++
void set_string(const string & s);
SNetObjectID::SSerializeString::size Method
C++
size_t size() const;
SNetObjectID::SSerializeString::SSerializeString Constructor ()
C++
AUTO_STRUCT_INFO SSerializeString();
SNetObjectID::SSerializeString::SSerializeString Constructor (SSerializeString &)
C++
SSerializeString(const SSerializeString & src);
SNetObjectID::SSerializeString::SSerializeString Constructor (char *)
C++
SSerializeString(const char * s);
Description

Casting to const char

SNetObjectID::SSerializeString::SSerializeString Constructor (char *, char *)
C++
explicit SSerializeString(const char * sbegin, const char * send);
SNetObjectID::id Data Member
C++
uint16 id;
SNetObjectID::InvalidId Data Member
C++
const uint16 InvalidId = ~uint16(0);
SNetObjectID::salt Data Member
C++
uint16 salt;
SNetObjectID::! Operator
C++
bool operator !() const;
SNetObjectID::!= Operator
C++
bool operator !=(const SNetObjectID& rhs) const;
SNetObjectID::< Operator
C++
bool operator <(const SNetObjectID& rhs) const;
SNetObjectID::== Operator
C++
bool operator ==(const SNetObjectID& rhs) const;
SNetObjectID::> Operator
C++
bool operator >(const SNetObjectID& rhs) const;
SNetObjectID::GetAsUint32 Method
C++
uint32 GetAsUint32() const;
SNetObjectID::GetMemoryUsage Method
C++
void GetMemoryUsage(ICrySizer * pSizer) const;
SNetObjectID::GetText Method
C++
const char * GetText(char * tmpBuf = 0) const;
SNetObjectID::IsLegal Method
C++
bool IsLegal() const;
SNetObjectID::SNetObjectID Constructor ()
C++
SNetObjectID();
SNetObjectID::SNetObjectID Constructor (uint16, uint16)
C++
SNetObjectID(uint16 i, uint16 s);
SNetObjectID::uint16 Method
C++
SNetObjectID::unknown_bool_type Operator
C++
operator unknown_bool_type() const;
SNetObjectID::TSerialize Nested Type
C++
typedef CSerializeWrapper<ISerialize> TSerialize;
Description

default serialize class to use!!