source: trunk/FACT++/src/Dim.h@ 10764

Last change on this file since 10764 was 10712, checked in by tbretz, 14 years ago
Some fixed to the doxygen docu
File size: 1.6 KB
Line 
1#ifndef FACT_Dim
2#define FACT_Dim
3
4#include <string>
5
6#include "dic.hxx"
7
8namespace Dim
9{
10 std::string GetLocalIp(const std::string &dns);
11 void Setup(const std::string &dns);
12
13 // --------------------------------------------------------------------------
14 //
15 //! Simplification wrapper to send a command without data
16 //!
17 //! Example:
18 //! - Dim::SendCommand("SERVER/COMMAND");
19 //!
20 //! @param command
21 //! Dim command identifier
22 //!
23 //! @returns
24 //! the return value of DimClient::sendCommand
25 //!
26 inline bool SendCommand(const std::string &command)
27 {
28 return DimClient::sendCommand(command.c_str(), NULL, 0);
29 }
30
31 // --------------------------------------------------------------------------
32 //
33 //! Simplification wrapper to send a command with the given data
34 //!
35 //! Example:
36 //! - Dim::SendCommand("SERVER/COMMAND", uint16_t(42));
37 //! - struct tm t; Dim::SendCommand("SERVER/TIME", t);
38 //!
39 //! @param command
40 //! Dim command identifier
41 //!
42 //! @param t
43 //! object to be sent, the pointer to the data to be sent is
44 //! set to &t
45 //!
46 //! @tparam T
47 //! type of the data to be sent. The size of the data to be sent
48 //! is determined as sizeof(T)
49 //!
50 //! @returns
51 //! the return value of DimClient::sendCommand
52 //!
53 template<typename T>
54 inline bool SendCommand(const std::string &command, const T &t)
55 {
56 return DimClient::sendCommand(command.c_str(), (void*)&t, sizeof(t));
57 }
58}
59
60#endif
Note: See TracBrowser for help on using the repository browser.