Table of Contents

Reminder about some coding stuff related to the Epeios project

New type naming conventions

(between parenthesis : the old one).

Summary

Grouped

Alphabetical

Static objects

Objects which size doesn't vary (integer, float…).

Objects which contains only objects of this type are also static objects.

Dynamic objects

Objects which size varies (a string, for example).

Objects which contains dynamic core (not instantiable) objects and/or static objects and/or resource-containing objects (see below) are also dynamic core objects.

The instantiable dynamic objects are mostly based on (and automatically created from) a dynamic core object. The dynamic core objects are used as function/method parameter type, but only the instantiable counterpart of such objects can be instantiated.

Objects which contains or are related to resources which have to be freed/deleted/closed…. (memory, socket, file descriptor, mutex…).

An object containing an instantiable variable size object is also a resource-containing object.

Callback objects

Objects given to an object/function, which contains only virtual methods ; it's abstract. Such an object has not to be initialized, only be inherited.

cObject (no direct equivalence).

Helper objects

Resource-containing helper

Objects given to an object/function, which is responsible of his handling. Such an object has not to be initialized, only be instantiated and then given to the proper object/function, in a error-aware environment, that is, wrapped with the qRx (qRH, qRB…) macros, to ensure proper destruction.

hObject (no direct equivalence).

Not resource-containing helper (groom)

Objects received as a parameters by a function. Such an object has not to be initialized, nor be instantiated.

gObject (no direct equivalence).

Example : mtk::gBlocker.

Placeholder helper

Objects given to an object/function, which is responsible of his handling. Such an object has not to be initialized, only be instantiated and then given to the proper object/function. It does not contain a resource, so no need of an error-aware environment.

pObject (no direct equivalence).

Example: csdbnc::pBuffer.

Macros equivalence

Apart from the q prefix, macro defined as equivalent for above objects use the prefix letter of the corresponding object as suffix letter. For macros which act as set of objects, you can also have a final l for the loose version, that is for the version with the generic row sdr::fRow.
Example :

Examples

Some examples for the developer of the Epeios project.

enum's

Header file ('.h')

qENUM( Name ) {
	nConfiguration,
	nProject,
	nSetup,
	nArguments,
	n_amount,
	n_Undefined
};
 
const char *GetLabel( eName Name );
 
eName GetName( const str::dString &Pattern );

Code ('.cpp')

#define C( name )	case n##name : return #name; break
 
const char *GetLabel( eName Name )
{
	switch ( Name ) {
	C( Configuration );
	C( Project );
	C( Setup );
	C( Arguments );
	default:
		qRFwk();
		break;
	}
 
	return NULL;	// To avoid a warning.
}
 
#undef C
 
namespace {
	stsfsm::wAutomat NameAutomat_;
 
	void FillNameAutomat_( void )
	{
		NameAutomat_.Init();
		stsfsm::Fill<eName>( NameAutomat_, n_amount, GetLabel );
	}
}
 
eName GetName( const str::dString &Pattern )
{
	return stsfsm::GetId( Pattern, NameAutomat_, n_Undefined, n_amount );
}
 
qGCTOR( ... )
{
	FillNameAutomat_();
}