Permalink
Browse files

removed dependency to boost::noncopyable

  • Loading branch information...
turleypol committed Feb 10, 2019
1 parent e96cabf commit 5ecbbf63f4cf19aad8ff6b6a1312097f411c35dc
@@ -11,23 +11,14 @@ namespace Clib
{
namespace Logging
{
using namespace std;
using std::chrono::system_clock;

///////////////////////////////////////////////////////////////////////////////

LogSink::LogSink() {}

LogSink::~LogSink() {}

///////////////////////////////////////////////////////////////////////////////

void LogSink::addTimeStamp( ostream& stream )
void LogSink::addTimeStamp( std::ostream& stream )
{
stream << getTimeStamp();
}

string LogSink::getTimeStamp()
std::string LogSink::getTimeStamp()
{
fmt::Writer writer;
time_t tClockTime = system_clock::to_time_t( system_clock::now() );
@@ -41,7 +32,6 @@ string LogSink::getTimeStamp()
return writer.str();
}

///////////////////////////////////////////////////////////////////////////////
}
}
} // namespaces
} // namespace Logging
} // namespace Clib
} // namespace Pol
@@ -6,7 +6,6 @@ Remove the include in all StdAfx.h files or live with the consequences :)
#ifndef CLIB_LOG_SINK_H
#define CLIB_LOG_SINK_H

#include <boost/noncopyable.hpp>
#include <iosfwd>
#include <string>

@@ -18,11 +17,14 @@ namespace Clib
{
namespace Logging
{
class LogSink : boost::noncopyable
class LogSink
{
public:
LogSink();
virtual ~LogSink();
LogSink() = default;
virtual ~LogSink() = default;

LogSink( const LogSink& ) = delete;
LogSink& operator=( const LogSink& ) = delete;

virtual void addMessage( fmt::Writer* msg ) = 0;
virtual void addMessage( fmt::Writer* msg, const std::string& id ) = 0;
@@ -37,8 +39,8 @@ class LogSink : boost::noncopyable
*/
static std::string getTimeStamp();
};
}
}
} // namespaces
} // namespace Logging
} // namespace Clib
} // namespace Pol

#endif
@@ -34,7 +34,6 @@
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/any.hpp>
#include <boost/flyweight.hpp>
#include <boost/noncopyable.hpp>

// Project Includes (be really really carefull what to include!)

@@ -72,14 +72,16 @@ void initLogging( LogFacility* logger )
}

// internal worker class which performs the work in a additional thread
class LogFacility::LogWorker : boost::noncopyable
class LogFacility::LogWorker
{
typedef std::function<void()> msg;
typedef message_queue<msg> msg_queue;

public:
// run thread on construction
LogWorker() : _done( false ), _queue(), _work_thread() { run(); }
LogWorker( const LogWorker& ) = delete;
LogWorker& operator=( const LogWorker& ) = delete;
// on deconstruction send exit
~LogWorker()
{
@@ -7,7 +7,6 @@ Remove the include in all StdAfx.h files or live with the consequences :)
#ifndef CLIB_LOGFACILITY_H
#define CLIB_LOGFACILITY_H

#include <boost/noncopyable.hpp>
#include <format/format.h>
#include <fstream>
#include <future>
@@ -140,11 +139,13 @@ class LogSink_dual final : public LogSink
};

// main class which starts the logging
class LogFacility : boost::noncopyable
class LogFacility
{
public:
LogFacility();
~LogFacility();
LogFacility( const LogFacility& ) = delete;
LogFacility& operator=( const LogFacility& ) = delete;
template <typename Sink>
void save( fmt::Writer* message, const std::string& id );
void registerSink( LogSink* sink );
@@ -11,18 +11,18 @@ Remove the include in all StdAfx.h files or live with the consequences :)
#include <list>
#include <mutex>

#include <boost/noncopyable.hpp>

namespace Pol
{
namespace Clib
{
template <typename Message>
class message_queue : boost::noncopyable
class message_queue
{
public:
message_queue();
~message_queue();
message_queue( const message_queue& ) = delete;
message_queue& operator=( const message_queue& ) = delete;

// push new message into queue and notify possible wait_pop
void push( Message const& msg );
@@ -176,7 +176,7 @@ void message_queue<Message>::cancel()
}
_notifier.notify_all();
}
}
}
} // namespace Clib
} // namespace Pol

#endif
#endif
@@ -1,14 +1,13 @@
#ifndef CLIB_STREAMSAVER_H
#define CLIB_STREAMSAVER_H

#include <boost/noncopyable.hpp>
#include <iosfwd>
#include <memory>
#include <string>
#include <thread>

#include <format/format.h>
#include "message_queue.h"
#include <format/format.h>
#if 0
#include "timer.h"
#endif
@@ -17,11 +16,13 @@ namespace Pol
{
namespace Clib
{
class StreamWriter : boost::noncopyable
class StreamWriter
{
public:
StreamWriter();
virtual ~StreamWriter() = default;
StreamWriter( const StreamWriter& ) = delete;
StreamWriter& operator=( const StreamWriter& ) = delete;
fmt::Writer& operator()();
virtual void init( const std::string& filepath ) = 0;
virtual void flush() = 0;
@@ -95,6 +96,6 @@ class ThreadedOFStreamWriter final : public StreamWriter
std::list<WriterPtr> _writers_hold;
std::string _stream_name;
};
}
}
} // namespace Clib
} // namespace Pol
#endif // CLIB_STREAMSAVER_H
@@ -433,10 +433,12 @@ size_t TaskThreadPool::size() const
}


class DynTaskThreadPool::PoolWorker : boost::noncopyable
class DynTaskThreadPool::PoolWorker
{
public:
PoolWorker( DynTaskThreadPool* parent, const std::string& name );
PoolWorker( const PoolWorker& ) = delete;
PoolWorker& operator=( const PoolWorker& ) = delete;
bool isbusy() const;
void join();
void run();
@@ -566,5 +568,5 @@ std::future<bool> DynTaskThreadPool::checked_push( const msg& msg )
} );
return ret;
}
}
}
} // namespace threadhelp
} // namespace Pol
@@ -8,7 +8,6 @@
#define CLIB_THREADHELP_H

#include <atomic>
#include <boost/noncopyable.hpp>
#include <functional>
#include <future>
#include <map>
@@ -71,7 +70,7 @@ class ThreadRegister
};


class TaskThreadPool : boost::noncopyable
class TaskThreadPool
{
typedef std::function<void()> msg;
typedef Clib::message_queue<msg> msg_queue;
@@ -80,6 +79,8 @@ class TaskThreadPool : boost::noncopyable
TaskThreadPool();
TaskThreadPool( const std::string& name );
TaskThreadPool( unsigned int max_count, const std::string& name );
TaskThreadPool( const TaskThreadPool& ) = delete;
TaskThreadPool& operator=( const TaskThreadPool& ) = delete;
~TaskThreadPool();
void push( const msg& msg );
std::future<bool> checked_push( const msg& msg );
@@ -95,7 +96,7 @@ class TaskThreadPool : boost::noncopyable
std::vector<std::thread> _threads;
};

class DynTaskThreadPool : boost::noncopyable
class DynTaskThreadPool
{
class PoolWorker;

@@ -106,6 +107,8 @@ class DynTaskThreadPool : boost::noncopyable
public:
DynTaskThreadPool( const std::string& name );
~DynTaskThreadPool();
DynTaskThreadPool( const DynTaskThreadPool& ) = delete;
DynTaskThreadPool& operator=( const DynTaskThreadPool& ) = delete;
void push( const msg& msg );
std::future<bool> checked_push( const msg& msg );
size_t threadpoolsize() const;
@@ -123,5 +126,5 @@ class DynTaskThreadPool : boost::noncopyable


} // namespace threadhelp
}
} // namespace Pol
#endif // CLIB_THREADHELP_H
@@ -12,7 +12,6 @@

#include "refptr.h"
#include <atomic>
#include <boost/noncopyable.hpp>

//
// weak_ptr_owner<T>
@@ -62,11 +61,13 @@ class weak_ptr : protected ref_ptr<weak_ptr_link<T>>
};

template <class T>
class weak_ptr_owner : public weak_ptr<T>, boost::noncopyable
class weak_ptr_owner : public weak_ptr<T>
{
public:
weak_ptr_owner();
~weak_ptr_owner();
weak_ptr_owner( const weak_ptr_owner& ) = delete;
weak_ptr_owner& operator=( const weak_ptr_owner& ) = delete;
void set( T* obptr );
};

@@ -2,7 +2,6 @@
#ifndef PLIB_SYTEMSTATE_H
#define PLIB_SYTEMSTATE_H

#include <boost/noncopyable.hpp>
#include <map>
#include <vector>
#if !defined( _WIN32 )
@@ -24,11 +23,13 @@ class Package;
typedef std::vector<Package*> Packages;
typedef std::map<std::string, Package*, Clib::ci_cmp_pred> PackagesByName;

class SystemState : boost::noncopyable
class SystemState
{
public:
SystemState();
~SystemState() = default;
SystemState( const SystemState& ) = delete;
SystemState& operator=( const SystemState& ) = delete;
void deinitialize();

Packages packages;
@@ -87,7 +87,7 @@ const char* getExpansionName( ExpansionVersion x );
class UOExpansion
{
public:
virtual ~UOExpansion(){};
virtual ~UOExpansion() = default;
virtual bool hasFeature( A9Feature feature ) const = 0;
virtual bool hasFeature( B9Feature feature ) const = 0;
virtual u32 A9Flags() const = 0;
@@ -116,9 +116,8 @@ class ClientFeatures
return myVersion >= version;
}

private: // noncopyable
ClientFeatures( const ClientFeatures& );
ClientFeatures& operator=( const ClientFeatures& );
ClientFeatures( const ClientFeatures& ) = delete;
ClientFeatures& operator=( const ClientFeatures& ) = delete;
};

class FlagExpansion : UOExpansion
@@ -149,6 +148,6 @@ class FlagExpansion : UOExpansion
virtual ExpansionVersion version() const override { return m_version; }
virtual int characterSlots() const override { return m_slots; }
};
}
}
} // namespace Plib
} // namespace Pol
#endif
@@ -7,7 +7,6 @@
#ifndef GLOBALS_MULTIDEFS_H
#define GLOBALS_MULTIDEFS_H

#include <boost/noncopyable.hpp>
#include <cstddef>
#include <map>

@@ -23,11 +22,13 @@ class MultiDef;
typedef std::map<u16, MultiDef*> MultiDefs;

// used for POL and uotool
class MultiDefBuffer : boost::noncopyable
class MultiDefBuffer
{
public:
MultiDefBuffer();
~MultiDefBuffer();
MultiDefBuffer( const MultiDefBuffer& ) = delete;
MultiDefBuffer& operator=( const MultiDefBuffer& ) = delete;

void deinitialize();
size_t estimateSize() const;
@@ -38,6 +39,6 @@ class MultiDefBuffer : boost::noncopyable
};

extern MultiDefBuffer multidef_buffer;
}
}
} // namespace Multi
} // namespace Pol
#endif
Oops, something went wrong.

0 comments on commit 5ecbbf6

Please sign in to comment.