YARP
Yet Another Robot Platform
Vocab.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2018 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #ifndef YARP_OS_VOCAB_H
11 #define YARP_OS_VOCAB_H
12 
13 #include <yarp/os/NetInt32.h>
14 #include <string>
15 
16 namespace yarp {
17  namespace os {
18  class Vocab;
19  }
20 }
21 
22 // We need a macro for efficient switching.
23 // Use as, for example, VOCAB3('s','e','t')
24 #ifndef SWIG_PREPROCESSOR_SHOULD_SKIP_THIS
25 #define VOCAB(a,b,c,d) ((((int)(d))<<24)+(((int)(c))<<16)+(((int)(b))<<8)+((int)(a)))
26 #define VOCAB4(a,b,c,d) VOCAB((a),(b),(c),(d))
27 #define VOCAB3(a,b,c) VOCAB((a),(b),(c),(0))
28 #define VOCAB2(a,b) VOCAB((a),(b),(0),(0))
29 #define VOCAB1(a) VOCAB((a),(0),(0),(0))
30 #endif // SWIG_PREPROCESSOR_SHOULD_SKIP_THIS
31 
56 class YARP_OS_API yarp::os::Vocab {
57 public:
65  static NetInt32 encode(const std::string& str);
66 
72  static std::string decode(NetInt32 code);
73 };
74 
75 #endif // YARP_OS_VOCAB_H
Short readable codes.
Definition: Vocab.h:56
The main, catch-all namespace for YARP.
Definition of the NetInt32 type.
Definition: NetInt32.h:36