YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Vocab64.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025-2025 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef YARP_OS_VOCAB64_H
7#define YARP_OS_VOCAB64_H
8
9#include <yarp/os/NetInt64.h>
10
11#include <string>
12
13namespace yarp::os {
14
15// We need a constexpr for efficient switching.
26constexpr yarp::conf::vocab64_t createVocab64(char a, char b = 0, char c = 0, char d = 0,
27 char e = 0, char f = 0, char g = 0, char h = 0)
28{
29 return (static_cast<yarp::conf::vocab64_t>(a)) +
30 (static_cast<yarp::conf::vocab64_t>(b) << 8) +
31 (static_cast<yarp::conf::vocab64_t>(c) << 16) +
32 (static_cast<yarp::conf::vocab64_t>(d) << 24) +
33 (static_cast<yarp::conf::vocab64_t>(e) << 32) +
34 (static_cast<yarp::conf::vocab64_t>(f) << 40) +
35 (static_cast<yarp::conf::vocab64_t>(g) << 48) +
36 (static_cast<yarp::conf::vocab64_t>(h) << 56);
37}
38
59namespace Vocab64 {
60
68YARP_os_API NetInt64 encode64(const std::string& str);
69
75YARP_os_API std::string decode64(NetInt64 code);
76
77} // namespace Vocab64
78
79} // namespace yarp::os
80
81#endif // YARP_OS_VOCAB64_H
A mini-server for performing network communication in the background.
std::int64_t vocab64_t
Definition numeric.h:79
NetInt64 encode64(const std::string &str)
Convert a string into a vocabulary identifier.
Definition Vocab64.cpp:10
std::string decode64(NetInt64 code)
Convert a vocabulary identifier into a string.
Definition Vocab64.cpp:48
An interface to the operating system, including Port based communication.
constexpr yarp::conf::vocab64_t createVocab64(char a, char b=0, char c=0, char d=0, char e=0, char f=0, char g=0, char h=0)
Create a vocab from chars.
Definition Vocab64.h:26
std::int64_t NetInt64
Definition of the NetInt64 type.
Definition NetInt64.h:29
#define YARP_os_API
Definition api.h:18