Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Status

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

Jira
serverICT
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverIdb8c705e3-ed92-32db-b3d0-8ff450afc249
keyICT-20138

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:

Jira
serverICT
serverIdb8c705e3-ed92-32db-b3d0-8ff450afc249
keyICT-19829