summaryrefslogtreecommitdiff
path: root/icetray/dryice/dryice.h
blob: 363956b4c4d253415ecc40de31a0882ccce4253c (plain)
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
#ifndef ICETRAY_TESTSETUP_H
#define ICETRAY_TESTSETUP_H

#include <Ice/Communicator.h>
#include <IceBox/IceBox.h>
#include <visibility.h>
#include "icetrayService.h"

namespace IceTray {
	class DLL_PUBLIC DryIce {
		public:
			DryIce(const Ice::StringSeq & = Ice::StringSeq());
			DryIce(const DryIce &) = delete;
			virtual ~DryIce();

			void operator=(const DryIce &) = delete;
			std::string getEndpoint() const;

		protected:
			friend class DryIceClient;
			static DryIce * currentDryIce;

			void replace(const std::string &, Ice::ObjectPtr);

			Ice::CommunicatorPtr ic;
			IceTray::ServicePtr s;
	};

	class DLL_PUBLIC DryIceClient {
		public:
			DryIceClient();
			virtual ~DryIceClient();

			template<typename Prx>
			Prx getProxy(const std::string & objectName) const
			{
				return Prx::checkedCast(DryIce::currentDryIce->ic->stringToProxy(objectName));
			}

			ServicePtr getService() const;
			Ice::ObjectAdapterPtr getAdapter() const;

		private:
			Ice::ObjectAdapterPtr adapter;
	};
}

#endif