/usr/include/lime/ConnectionRegistry.h is in liblimesuite-dev 16.12.0+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | /**
@file ConnectionRegistry.h
@author Lime Microsystems
@brief Registration and access for possible connection types.
*/
#ifndef CONNECTION_REGISTRY_H
#define CONNECTION_REGISTRY_H
#include <LimeSuiteConfig.h>
#include <ConnectionHandle.h>
#include <string>
#include <vector>
namespace lime{
class IConnection;
/*!
* The connection registry provides a way to register
* discovery methods and factories for known connections,
* and to query and instantiate available connections.
*/
class LIME_API ConnectionRegistry
{
public:
/*!
* Discovery identifiers that can be used to create a connection.
* The hint may contain a connection type, serial number, ip address, etc.
* \param hint an optional connection handle with some fields filled-in
* \return a list of handles which can be used to make a connection
*/
static std::vector<ConnectionHandle> findConnections(const ConnectionHandle &hint = ConnectionHandle());
/*!
* Create a connection from an identifying handle.
* Return a null pointer when no factories are available.
* \param handle a connection handle with fields filled-in
* \return a pointer to a connection instance (or null)
*/
static IConnection *makeConnection(const ConnectionHandle &handle);
/*!
* Free an connection created by makeConnection().
*/
static void freeConnection(IConnection *conn);
//! Get a list of available registry entry modules by name
static std::vector<std::string> moduleNames(void);
};
/*******************************************************************
* This section below is the registry API for connections.
* The registry API is intended for device developers.
******************************************************************/
/*!
* Create an overloaded instance of a ConnectionRegistryEntry
* to register discovery and factory functions into the system.
* The ConnectionRegistryEntry should be created prior to
* discovering and instantiating connections.
* One recommended use is at static initialization time.
*/
class LIME_API ConnectionRegistryEntry
{
public:
/*!
* Instantiating the ConnectionRegistryEntry
* registers it into the connection registry.
* The name describes the type of connection,
* that should be unique to the entry instance.
*/
ConnectionRegistryEntry(const std::string &name);
//! Unregister a connection type
virtual ~ConnectionRegistryEntry(void);
/*!
* A discovery function takes a connection handle hint
* and returns a list of identifiers that can be used
* to create connection with makeConnection().
* \param hint an optional connection handle with some fields filled-in
* \return a list of handles which can be used to make a connection
*/
virtual std::vector<ConnectionHandle> enumerate(const ConnectionHandle &hint) = 0;
/*!
* A factory function creates a connection from a connection handle.
* \param handle a connection handle with fields filled-in
* \return a pointer to a connection instance
*/
virtual IConnection *make(const ConnectionHandle &handle) = 0;
private:
std::string _name;
};
}
#endif
|