summaryrefslogtreecommitdiff
path: root/src/syncCommand.h
blob: b7385139282f8a687ac897f20fd5a21234b9ca61 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef _SYNCCOMMAND_H
#define _SYNCCOMMAND_H
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>

#include "connectionList.h"
#include "threadUtils.hpp"
#include "syncConnectionCommand.h"
#include "syncRouteCommand.h"
#include "syncRtpCommand.h"
#include "networkPrefix.h"
#include <string>

class SyncCommand
{
public:
	SyncCommand(ConnectionList & cl );
	SyncCommand(ConnectionList & cl ,u_int16_t mux);
	SyncCommand(const std::string &);
	SyncCommand(NetworkPrefix);
	~SyncCommand();

private:
	SyncCommand(const SyncCommand &);
	SyncConnectionCommand * scc_;
	SyncRouteCommand * src_;
	SyncRtpCommand * srtpc_;
  friend class boost::serialization::access;
  template<class Archive>
  void serialize(Archive & ar, const unsigned int version)
  {
		std::string syncstr;
		if (scc_)
		{
			syncstr = "connection";
		}
		if ( src_)
		{
			syncstr = "route";
		}
		if ( srtpc_)
		{
			syncstr = "rtp";
		}
    ar & syncstr;
//		std::cout << "syncstr received " <<syncstr << std::endl;
		if (syncstr == "connection")
			ar & *scc_;
		if (syncstr == "route")
			ar & *src_;
		if (syncstr == "rtp")
			ar & *srtpc_;
//		std::cout << "syncstr done " <<syncstr << std::endl;
	}
};


#endif // _SYNCCOMMAND_H