From 50dd460655e0ab563de388bad37d3f678ffbb3b4 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 20 Mar 2007 23:13:52 +0000 Subject: Minor updates to the Hash and FString, Hash got a getKeys function, and FString got the more normal getStr and getSize functions. --- src/fstring.h | 23 +++++++++++++++++++++++ src/hash.h | 19 +++++++++++++++++++ src/serializerconnection.cpp | 14 ++++++++++++++ src/serializerconnection.h | 23 +++++++++++++++++++++++ 4 files changed, 79 insertions(+) create mode 100644 src/serializerconnection.cpp create mode 100644 src/serializerconnection.h diff --git a/src/fstring.h b/src/fstring.h index 2f508b7..c3ab6cd 100644 --- a/src/fstring.h +++ b/src/fstring.h @@ -143,6 +143,29 @@ public: nLength = nNewSize; } + long getSize() + { + return nLength; + } + + chr *getStr() + { + if( pFirst == NULL ) + return NULL; + + flatten(); + return pFirst->pData; + } + + const chr *getStr() const + { + if( pFirst == NULL ) + return NULL; + + flatten(); + return pFirst->pData; + } + chr *c_str() { if( pFirst == NULL ) diff --git a/src/hash.h b/src/hash.h index c37cfba..81b472f 100644 --- a/src/hash.h +++ b/src/hash.h @@ -5,6 +5,7 @@ #include #include #include +#include #include "exceptionbase.h" #include "hashable.h" #include "serializable.h" @@ -450,6 +451,24 @@ public: return iterator( *this, true ); } + std::list getKeys() + { + std::list lKeys; + + for( uint32_t j = 0; j < nCapacity; j++ ) + { + if( isFilled( j ) ) + { + if( !isDeleted( j ) ) + { + lKeys.push_back( aKeys[j] ); + } + } + } + + return lKeys; + } + protected: virtual void onInsert() {} virtual void onUpdate() {} diff --git a/src/serializerconnection.cpp b/src/serializerconnection.cpp new file mode 100644 index 0000000..b2c545c --- /dev/null +++ b/src/serializerconnection.cpp @@ -0,0 +1,14 @@ +#include "serializerconnection.h" + +SerializerConnection::SerializerConnection( + Connection *pCon, int nTimeSec, int nTimeUSec ) : + pCon( pCon ), + nTimeSec( nTimeSec ), + nTimeUSec( nTimeUSec ) +{ +} + +SerializerConnection::~SerializerConnection() +{ +} + diff --git a/src/serializerconnection.h b/src/serializerconnection.h new file mode 100644 index 0000000..85ee84d --- /dev/null +++ b/src/serializerconnection.h @@ -0,0 +1,23 @@ +#ifndef SERIALIZER_CONNECTION_H +#define SERIALIZER_CONNECTION_H + +#include + +#include "serializer.h" + +/** + * + */ +class SerializerConnection : public Serializer +{ +public: + SerializerConnection( Connection *pCon, int nTimeSec, int nTimeUSec ); + virtual ~SerializerConnection(); + +private: + Connection *pCon; + int nTimeSec; + int nTimeUSec; +}; + +#endif -- cgit v1.2.3