-
-
Notifications
You must be signed in to change notification settings - Fork 17
Classes
Class name has to start with 'C', interface with 'I'. Associated files are named without the 'C'.
CommunicationModule.h :
#pragma once
class CCommunicationModule: public ICommunicationModule
{
public:
CCommunicationModule();
virtual ~CCommunicationModule();
};CommunicationModule.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.
int m_portNumber;
CThread* m_thread;Constants/statics begin by an upper-case letter.
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.
#pragma once
class ICommunicationModule
{
public:
virtual ~ICommunicationModule();
// ... 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 :
std::string m_name;Use of namespace shortcut is allowed :
namespace po = boost::program_options;
Yadoms -- The ultimate house automation solution