[seiscomp, scanloc] Install, add .gitignore
This commit is contained in:
120
include/seiscomp/messaging/messages/database.h
Normal file
120
include/seiscomp/messaging/messages/database.h
Normal file
@ -0,0 +1,120 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_CLIENT_DATABASEMESSAGE_H
|
||||
#define SEISCOMP_CLIENT_DATABASEMESSAGE_H
|
||||
|
||||
|
||||
#include <seiscomp/messaging/messages/service.h>
|
||||
#include <seiscomp/io/database.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
|
||||
// Forward declarations
|
||||
namespace IO {
|
||||
|
||||
class DatabaseInterface;
|
||||
|
||||
}
|
||||
|
||||
namespace Client {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(DatabaseRequestMessage);
|
||||
|
||||
/**
|
||||
* \brief Message for requesting a database service
|
||||
* This message type requests a databaseservice.
|
||||
* The servicename is optional. If the servicename is not
|
||||
* given the serviceprovider can choose between different
|
||||
* services it offers of this type.
|
||||
* So if the provider offers a mysql database and a postgresql
|
||||
* database it can select the published service by its own.
|
||||
* If the servicename is set the provider has to publish
|
||||
* the service matching this name if it is able to do so.
|
||||
*/
|
||||
class SC_SYSTEM_CLIENT_API DatabaseRequestMessage : public ServiceRequestMessage {
|
||||
DECLARE_SC_CLASS(DatabaseRequestMessage)
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
DatabaseRequestMessage();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param service The requested service name.
|
||||
* The name can be set nullptr to let the
|
||||
* service request handler decide which
|
||||
* interface it will return.
|
||||
*/
|
||||
DatabaseRequestMessage(const char *service);
|
||||
};
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(DatabaseProvideMessage);
|
||||
|
||||
/**
|
||||
* \brief Message for providing a database service
|
||||
* When receiving this message a corresponding databaseinterface
|
||||
* can be created which one connects to using the provided
|
||||
* parameters.
|
||||
* \code
|
||||
* DatabaseProvideMessagePtr msg = DatabaseProvideMessage_Cast(con->read());
|
||||
* Seiscomp::IO::DatabaseInterfacePtr db = msg->interface();
|
||||
* if ( db != nullptr ) {
|
||||
* // do fancy things with the interface
|
||||
* }
|
||||
* \endcode
|
||||
*/
|
||||
class SC_SYSTEM_CLIENT_API DatabaseProvideMessage : public ServiceProvideMessage {
|
||||
DECLARE_SC_CLASS(DatabaseProvideMessage)
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
DatabaseProvideMessage();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param service The provided service name.
|
||||
* @param params The connection parameters.
|
||||
*/
|
||||
DatabaseProvideMessage(const char *service,
|
||||
const char *params);
|
||||
|
||||
public:
|
||||
/**
|
||||
* Returns a database interface for the provided service
|
||||
* which is already connected to the database.
|
||||
* @return The connected database interface. nullptr, if the
|
||||
* databaseinterface cannot be created or if the
|
||||
* connection fails.
|
||||
* NOTE: The caller is reponsible for deleting the
|
||||
* returned object.
|
||||
*/
|
||||
IO::DatabaseInterface *database() const;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
122
include/seiscomp/messaging/messages/service.h
Normal file
122
include/seiscomp/messaging/messages/service.h
Normal file
@ -0,0 +1,122 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_MESSAGING_MESSAGES_DATABASE_H
|
||||
#define SEISCOMP_MESSAGING_MESSAGES_DATABASE_H
|
||||
|
||||
|
||||
#include <seiscomp/core/message.h>
|
||||
#include <seiscomp/client.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace Client {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(ServiceRequestMessage);
|
||||
|
||||
/**
|
||||
* \brief Message for requesting a service
|
||||
* This class is the base class for all kinds of service
|
||||
* requests being sent over the network.
|
||||
* It holds an optional servicename. If the servicename
|
||||
* is not set the request handler can choose a service
|
||||
* matching the servicetype defined by the classname.
|
||||
* A message of this type cannot not be sent. One has to
|
||||
* derive a class to define the type of service (database,
|
||||
* fileaccess, ...).
|
||||
*/
|
||||
class SC_SYSTEM_CLIENT_API ServiceRequestMessage : public Core::Message {
|
||||
DECLARE_SC_CLASS(ServiceRequestMessage)
|
||||
DECLARE_SERIALIZATION;
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
ServiceRequestMessage();
|
||||
|
||||
/**
|
||||
* C'tor
|
||||
* @param service The requested service name.
|
||||
* The name can be set nullptr to let the
|
||||
* service request handler decide which
|
||||
* interface it will return.
|
||||
*/
|
||||
ServiceRequestMessage(const char *service);
|
||||
|
||||
//! Implemented interface from Message
|
||||
bool empty() const override;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @return The requested service name
|
||||
*/
|
||||
const char* service() const;
|
||||
|
||||
private:
|
||||
std::string _serviceName;
|
||||
};
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(ServiceProvideMessage);
|
||||
|
||||
/**
|
||||
* \brief Message for providing a service
|
||||
* This class is the base class for all kinds of service
|
||||
* providers.
|
||||
* It holds a servicename and the connection parameters.
|
||||
*/
|
||||
class SC_SYSTEM_CLIENT_API ServiceProvideMessage : public Seiscomp::Core::Message {
|
||||
DECLARE_SC_CLASS(ServiceProvideMessage)
|
||||
DECLARE_SERIALIZATION;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Constructor
|
||||
* @param service The provided service name.
|
||||
* @param params The connection parameters.
|
||||
*/
|
||||
ServiceProvideMessage(const char *service,
|
||||
const char *params);
|
||||
|
||||
public:
|
||||
/**
|
||||
* @return The provided service name.
|
||||
*/
|
||||
const char *service() const;
|
||||
|
||||
/**
|
||||
* @return The connection parameters.
|
||||
*/
|
||||
const char *parameters() const;
|
||||
|
||||
//! Implemented interface from Message
|
||||
virtual bool empty() const;
|
||||
|
||||
private:
|
||||
std::string _serviceName;
|
||||
std::string _parameters;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user