ImagingTools Core SDK
Public Member Functions | List of all members
imtcom::CServerConnectionInterfaceParam

Basic implementation of IServerConnectionInterface with protocol-port mapping. More...

#include <CServerConnectionInterfaceParam.h>

Inheritance diagram for imtcom::CServerConnectionInterfaceParam:
imtcom::IServerConnectionInterface imtcom::CServerConnectionInterfaceParamComp

Public Member Functions

 CServerConnectionInterfaceParam ()
 Default constructor.
 
void RegisterProtocol (ProtocolType protocol)
 Register a protocol as supported.
 

Additional Inherited Members

- Public Types inherited from imtcom::IServerConnectionInterface
enum  ProtocolType {
  PT_UNKNOWN , PT_HTTP , PT_WEBSOCKET , PT_FILE ,
  PT_GRPC
}
 Communication protocols supported by server connections. More...
 
enum  ConnectionFlags { CF_DEFAULT = 0x1 , CF_SECURE = 0x2 }
 Flags controlling connection security and behavior. More...
 
typedef QList< ProtocolTypeProtocolTypes
 List of protocol types for querying supported protocols.
 

Detailed Description

Basic implementation of IServerConnectionInterface with protocol-port mapping.

CServerConnectionInterfaceParam provides the core data storage and logic for server connection configuration. It maintains a map of protocols to port numbers and implements all methods defined by IServerConnectionInterface.

This class serves as the base for CServerConnectionInterfaceParamComp and can be used directly in non-ACF contexts where component infrastructure is not needed.

Key Features

Protocol Registration:

Port Mapping:

URL Generation:

Serialization:

Change Management:

Usage Example

// Create instance
// Register protocols
// Configure connection
connection.SetHost("api.example.com");
connection.SetPort(IServerConnectionInterface::PT_HTTP, 8080);
connection.SetPort(IServerConnectionInterface::PT_WEBSOCKET, 8081);
connection.SetConnectionFlags(IServerConnectionInterface::CF_SECURE);
// Generate URLs
QUrl httpUrl, wsUrl;
connection.GetUrl(IServerConnectionInterface::PT_HTTP, httpUrl);
// httpUrl = "https://api.example.com:8080"
connection.GetUrl(IServerConnectionInterface::PT_WEBSOCKET, wsUrl);
// wsUrl = "wss://api.example.com:8081"
// Check supported protocols
auto protocols = connection.GetSupportedProtocols();
qDebug() << "Supports" << protocols.size() << "protocols";
Basic implementation of IServerConnectionInterface with protocol-port mapping.
void RegisterProtocol(ProtocolType protocol)
Register a protocol as supported.
@ PT_WEBSOCKET
WebSocket/WSS protocol for real-time bidirectional communication (default port: 9000)
@ PT_HTTP
HTTP/HTTPS protocol for RESTful APIs (default port: 9001)
@ CF_SECURE
Secure connection with SSL/TLS encryption (HTTPS, WSS)

Serialization Format

The class serializes the following data:

Thread Safety

This class is not thread-safe. If accessed from multiple threads, external synchronization is required. Consider using CServerConnectionInterfaceParamComp which may provide additional thread safety through component framework.

See also
IServerConnectionInterface, CServerConnectionInterfaceParamComp

Definition at line 101 of file CServerConnectionInterfaceParam.h.

Constructor & Destructor Documentation

◆ CServerConnectionInterfaceParam()

imtcom::CServerConnectionInterfaceParam::CServerConnectionInterfaceParam ( )

Default constructor.

Initializes the connection parameter with:

  • Connection flags: CF_DEFAULT (insecure)
  • Host: empty string
  • Port map: empty (no protocols registered)

Member Function Documentation

◆ RegisterProtocol()

void imtcom::CServerConnectionInterfaceParam::RegisterProtocol ( ProtocolType  protocol)

Register a protocol as supported.

Adds the specified protocol to the list of supported protocols. Once registered, the protocol can be configured with SetPort() and queried with GetPort() and GetUrl().

Registering a protocol does not set a port - you must call SetPort() separately to configure the port number.

Parameters
protocolProtocol type to register.
See also
GetSupportedProtocols(), SetPort()
Example:
// Register protocols you want to support
// Now configure ports
connection.SetPort(IServerConnectionInterface::PT_HTTP, 8080);
connection.SetPort(IServerConnectionInterface::PT_GRPC, 50051);
@ PT_GRPC
gRPC protocol for high-performance RPC (default port: 50101)