summaryrefslogtreecommitdiff
path: root/syncConnectionCommand.h
blob: 225ec9c9811caab08840cf751eb2219c4ec1f3d5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef _SYNCCONNECTIONCOMMAND_H
#define _SYNCCONNECTIONCOMMAND_H
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>

#include "connectionList.h"
#include "threadUtils.hpp"

class SyncConnectionCommand
{
public:
	SyncConnectionCommand(ConnectionList & cl );
	SyncConnectionCommand(ConnectionList & cl ,u_int16_t mux);
	u_int16_t getMux() const;

private:
	SyncConnectionCommand(const SyncConnectionCommand &);
	ConnectionList & cl_;
	u_int16_t mux_;
  friend class boost::serialization::access;
  template<class Archive>
  void serialize(Archive & ar, const unsigned int version)
  {
		Lock lock(cl_.getMutex());
    ar & mux_;
		ConnectionParam & conn = cl_.getOrNewConnectionUnlocked(mux_);
		ar & conn;
	}
};


#endif // _SYNCCOMMAND_H