C++ Micro Services

C++ MicroServices库提供基于OSGi R4.2规范的服务层动态服务注册库,允许实现服务导向的方法,提高组件复用性,降低耦合度,清晰API合同等优势。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://cppmicroservices.org/

Introduction

The C++ Micro Services library provides a dynamic service registry based on theservice layer as specified in the OSGi R4.2 specifications. It enables users torealize a service oriented approach within their software stack.

The advantages include higher reuse of components, looser coupling, better organization ofresponsibilities, cleaner API contracts, etc.

Requirements

This is a pure C++ implementation of the OSGi service model and does not have any third-partylibrary dependencies.

Supported Platforms

The library should compile on many different platforms. Below is a list of tested compiler/OS combinations:

  • GCC 4.5 (Ubuntu 11.04 and MacOS X 10.6)
  • Visual Studio 2008 and 2010
  • Clang 3.0 (Ubuntu 11.04 and MacOS X 10.6)

Copyright (c) German Cancer Research Center. Licensed under the Apache License v2.0.

Quick Start

Essentially, the C++ Micro Services library provides you with a powerful dynamic service registry.Each shared or static library has an associated ModuleContext object, through which the serviceregistry is accessed.

To query the registry for a service object implementing one or more specific interfaces, the codewould look like this:

#include <usModuleContext.h>
#include <someInterface.h>

using namespace us;

void UseService(ModuleContext* context)
{
  ServiceReference serviceRef = context->GetServiceReference<SomeInterface>();
  if (serviceRef)
  {
    SomeInterface* service = context->GetService<SomeInterface>(serviceRef);
    if (service) { /* do something */ }
  }
}

Registering a service object against a certain interface looks like this:

#include <usModuleContext.h>
#include <someInterface.h>

using namespace us;

void RegisterSomeService(ModuleContext* context, SomeInterface* service)
{
  context->RegisterService<SomeInterface>(service);
}

The OSGi service model additionally allows to annotate services with properties and using theseproperties during service look-ups. It also allows to track the life-cycle of service objects.Please see the Documentation for moreexamples and tutorials and the API reference. There is also a blog post aboutOSGi Lite for C++.

Build Instructions

Please visit the Build Instructions page online.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值