Class name has to start with 'C'. Associated files are named without the 'C'.
CommunicationModule.h :
:::cpp
#pragma once
class CCommunicationModule: public CBaseFrameHandlerComponent
{
public:
CCommunicationModule();
virtual ~CCommunicationModule();
};
CommunicationModule.cpp :
:::cpp
#include "CommunicationModule.h"
CCommunicationModule::CCommunicationModule()
{}
CCommunicationModule::~CCommunicationModule()
{}
Member variables begin by 'm_'. First letter lower-case, and upper-case for each next word first letter. 'p' has to be added after 'm_', if member is a pointer (in this case, first word begins with an upper-case letter).
:::cpp
int m_portNumber;
CThread* m_pThread;
Constants/statics begin by an upper-case letter.
:::cpp
const int DefaultPort = 1664;
static std::string RelativePath;
Except for interfaces, constructor/destructor have to be present in the class even if empty, to specify that they was intentionally set.
Don't forget to declare destructor as virtual.
Each interface (pure virtual class), must begin with the public virtual destructor, and must not contain constructor.
:::cpp
#pragma once
class IMyInterface
{
public:
virtual ~IMyInterface();
// ... Interface methods ...
};
Passing parameter to function has to be made by reference as much as possible.
Public variable members have to be avoid. Add get/set accessors.
"use namespace" should be avoid in .h/.hpp. Full specification has to be used :
:::cpp
std::string m_name;
Use of namespace shortcut is allowed :
:::cpp
namespace po = boost::program_options;