You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Status

Work in progress to be delivered as part of 2022JUN:

Unable to locate Jira server for this macro. It may be due to Application Link configuration.

Background

ACS makes use of Loki and ACE libraries to implement singleton functionalities. Loki is an old library providing support for singleton; on the other hand ACE is a maintained middleware for portability which also offers singleton implementation because it was not officially offered by C++ or Boost years ago. The problem is that the support for Loki library was discontinued and it is becoming a legacy software in ACS. These days the standard C++ library provides a mechanism for clean and thread-safe singleton implementations based on static variables, hence it would make sense to migrate the existing singletons to one of the two clean mechanisms available depending on the requirements.

Alternatives

  • Define a static variable on the class, which is an instance of itself. This has the limitation that the class is initialized at startup and no parameters can be loaded up
  • Define a static variable on the class, which is a pointer to an instance of itself. Here the limitation is removed, but this forces us to create/destroy the instance or wrap around a smart pointer
  • Define a static variable on a singleton method such as <class>::instance(), <class>::get(), etc.

Implementation

The implementation is ultimately based on the third alternative respecting the standard API and allowing for a smoother use by the community. The implementation is marked for 2022APR release. Details can be found in the ticket:

Unable to locate Jira server for this macro. It may be due to Application Link configuration.

  • No labels