simple C/C++ Serialization or deflating or Marshalling user defined data types or objects

But is it to use boost or not it is your decision 🙂  It is a good lib. But I find it very handy for small in another way as below;-

// Just a simple serialization in C++

#include <string>

typedef char*	BuffPtr;
typedef size_t	BuffLen;

class CVariableLenData
	//Serilizes data members to a char buffer
	void Serialize(BuffPtr &ptr, BuffLen len, BuffLen &writelen) const;

	//DeSerilizes from a char buffer & constructs an object
	static CVariableLenData* DeSerialize(const BuffPtr ptr, BuffLen len);

	void SetData(std::string& str);
	void SetData(int& val);

	int m_some_int;			// fixed length
	std::string m_some_str; // variable length
	CVariableLenData(const CVariableLenData&);


// Source file
#include <cstdio>
#include "CVariableLenData.h"

using namespace std;


void CVariableLenData::Serialize(BuffPtr &ptr, BuffLen bufflen, BuffLen& writelen) const
	writelen = _snprintf (ptr, bufflen,"%d", m_some_int);
	*(ptr+writelen) = ' ';		// after each numeric value add an space
	size_t len = writelen + 1;
	// now write the string
	// copy length
	writelen = _snprintf ( (ptr+len), bufflen,"%u", m_some_str.length());
	*(ptr + len ) = ' ';
	len = len + writelen + 1;
	// Copy the data
	memcpy( (ptr+len), m_some_str.c_str(), m_some_str.length());
	writelen = len;

Some links.

Usefull command for Linux Developers

Locating a variable, function or finding a variable, or finding the occurrence / usage of function / variable in an efficient way. For example, you want to find the header file which defines a constant “PATH_MAX”.

    find / -iname *.h | xargs grep -Hn “PATH_MAX”

    or, if you want to redirect the errors, then

    find / -iname *.h 2> /dev/null | xargs grep -Hn “PATH_MAX”

    JDBC : Ldap – sql bridge

    I am not able to find a suitable use case for this one. I do not know what requirement it will serve other than maintaining some legacy one. Maybe i am wrong.

    Some links:

    Some usefull GCC options for preprocessor

    We pass the `-gdwarf-2′ and `-g3′

    flags to ensure the compiler includes information about preprocessor macro. For example;-

    gcc -gdwarf-2 -g3 sample.c -o sample
    To print the preprocessor output and stop there :
    gcc -E sample.c