List of all members | Classes | Public Member Functions | Public Attributes | Private Types | Private Attributes
utl::Deprecator Class Reference

Class to collect and provide information about deprecated class interfaces. More...

#include <utl/Deprecator.h>

Inheritance diagram for utl::Deprecator:
Inheritance graph
[legend]

Classes

class  DeprecationInfo
 Information about the deprecated interface. More...
 

Public Member Functions

void Deprecated (const std::string &theInterface, const std::string &theVersion, const std::string &theNewUsageHint)
 Log the usage of a deprecated interface and emit a warning. More...
 
 Deprecator ()
 Constructor. More...
 
std::string GetReport () const
 Get the final report on interface usage problems. More...
 
std::size_t GetSize () const
 Size, i.e., number of different deprecated interfaces uses. More...
 
bool IsEmpty () const
 Check if empty, i.e., no deprecated usage registered. More...
 

Public Attributes

static Deprecator &return instance
 

Private Types

typedef std::map< std::string,
DeprecationInfo
DataMap
 

Private Attributes

DataMap fData
 

Detailed Description

Class to collect and provide information about deprecated class interfaces.

A central deprecation log is used to collect the information about all uses of deprecated interfaces. Use the Deprecator::GetInstance() call to get a reference to the central deprecation log. The member function Deprecated() is used to log the use of a deprecated interface. At the end of the run, use GetReport() to obtain a string reporting the deprecated interface uses.

class C {
public:
void NewInterface();
void
OldInterface()
{
Deprecator::GetInstance().Deprecated(
"OldInterface", "v9r3", "See documentation page 3, use NewInterface"
);
NewInterface();
}
};
Note
If an interface gets deprecated, it should also get marked as such in the doxygen documentation using the \deprecated command. The documentation should include the time when the interface is expected to go away. This information might also get listed in the hint argument of the Deprecated() call.
If needed, on could add other reporting facilities to get the report in XML format or to get the raw data.
Author
Lukas Nellen
Date
22 Jan 2008

Definition at line 54 of file Deprecator.h.

Member Typedef Documentation

typedef std::map<std::string, DeprecationInfo> utl::Deprecator::DataMap
private

Definition at line 107 of file Deprecator.h.

Constructor & Destructor Documentation

utl::Deprecator::Deprecator ( )
inline

Constructor.

Note
The constructor is not protected to make it possible to create instances of the class for testing. For use in a real application, use the static GetInstance() function to get the central deprecation register.

Definition at line 62 of file Deprecator.h.

Member Function Documentation

void utl::Deprecator::Deprecated ( const std::string &  theInterface,
const std::string &  theVersion,
const std::string &  theNewUsageHint 
)

Log the usage of a deprecated interface and emit a warning.

Parameters
theInterfaceThe name of the deprecated interface
theVersionThe version where this interface got deprecated in
theNewUsageHintInformation about what to do in the future

Definition at line 21 of file Deprecator.cc.

References WARNING_TERSE.

Referenced by testDeprecator::testCentralDeprecator().

string utl::Deprecator::GetReport ( ) const

Get the final report on interface usage problems.

Definition at line 37 of file Deprecator.cc.

References utl::delr, utl::endc, utl::endr, utl::hline(), result, and utl::TabularStream::Str().

Referenced by testDeprecator::testCentralDeprecator().

std::size_t utl::Deprecator::GetSize ( ) const
inline

Size, i.e., number of different deprecated interfaces uses.

Definition at line 78 of file Deprecator.h.

References fData.

Referenced by testDeprecator::testCentralDeprecator().

bool utl::Deprecator::IsEmpty ( ) const
inline

Check if empty, i.e., no deprecated usage registered.

Definition at line 75 of file Deprecator.h.

References fData.

Referenced by testDeprecator::testCentralDeprecator().

Member Data Documentation

DataMap utl::Deprecator::fData
private

Definition at line 108 of file Deprecator.h.

Referenced by GetSize(), and IsEmpty().

Deprecator & return utl::Singleton< Deprecator >::instance
inherited

Definition at line 44 of file Singleton.h.


The documentation for this class was generated from the following files:

, generated on Tue Sep 26 2023.