Take the 2-minute tour ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

I decided to abstract out some of the code I use in personal projects into a library. In particular, it'd be used primarily for server-side programs, but I don't see any reason it wouldn't work fine in a client-side program as well.

There isn't a ton there currently, but any type of feedback would be great. I mostly program solo and generally only for personal projects, so it'd be nice to know what I'm doing well and what I'm doing wrong.

In particular, I'm not sure what the best way to approach providing a header file for inclusion is. Using libraries like OpenSSL and cURL, it always seems there's a single header file (or one per "module") to include. How I'm doing it now is listed below, but it doesn't seem very maintainable:

#ifndef PUKE_H
#define PUKE_H

#define PUKE_MAJOR_VERSION 0
#define PUKE_MINOR_VERSION 1




#include "Config.h"
#include "Connection.h"
#include "Message.h"
#include "MessageContainer.h"
#include "Mutex.h"
#include "NetworkMessage.h"
#include "NetworkQueue.h"
#include "Queue.h"
#include "Server.h"
#include "Thread.h"
#include "Timer.h"


// Posix

#if defined PUKE_POSIX

#include "posix/PosixMutex.h"
#include "posix/PosixThread.h"
#include "posix/PosixTimer.h"

#endif




// Windows

#if defined PUKE_WINDOWS

#include "windows/WindowsMutex.h"
#include "windows/WindowsThread.h"
#include "windows/WindowsTimer.h"

#endif




// Factory

#include "factory/MutexFactory.h"
#include "factory/ThreadFactory.h"
#include "factory/TimerFactory.h"




// Posix Factory

#if defined PUKE_POSIX

#include "factory/posix/PosixMutexFactory.h"
#include "factory/posix/PosixThreadFactory.h"
#include "factory/posix/PosixTimerFactory.h"

#endif




// Windows Factory

#if defined PUKE_WINDOWS

#include "factory/windows/WindowsMutexFactory.h"
#include "factory/windows/WindowsThreadFactory.h"
#include "factory/windows/WindowsTimerFactory.h"

#endif




#endif

The entire code base can be found on GitHub.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.