Commit 3928c7c7 authored by Andrea Valassi's avatar Andrea Valassi
Browse files

Resync to COOL30x with scoped enum API changes


git-svn-id: file:///git/lcgcool.svndb/cool/trunk@18977 4525493e-7705-40b1-a816-d608a930855b
parent b0b261bb
// $Id: ChannelSelection.h,v 1.24 2012-07-08 20:02:33 avalassi Exp $
#ifndef COOLKERNEL_CHANNELSELECTION_H
#define COOLKERNEL_CHANNELSELECTION_H 1
// First of all, enable or disable the COOL290 API extensions (see bug #92204)
// First of all, set/unset CORAL290, COOL300, COOL400 and COOL_HAS_CPP11 macros
#include "CoolKernel/VersionInfo.h"
// Include files
#include <limits>
#ifdef COOL400CPP11ENUM
#include <ostream>
#endif
#include <vector>
#include "CoolKernel/ChannelId.h"
......@@ -68,14 +70,28 @@ namespace cool
/// There are two possible orders to browse IOVs (within a tag) across
/// many channels: 'order by channel, since' and 'order by since, channel'.
/// The second set of the ordering scheme lists the IOVs in reverse order.
enum Order {
#ifndef COOL400CPP11ENUM
enum Order
#else
enum class Order
#endif
{
channelBeforeSince, sinceBeforeChannel,
channelBeforeSinceDesc, sinceDescBeforeChannel
};
#ifdef COOL400CPP11ENUM
// Overloaded operator<< for cool::ChannelSelection::Order
inline friend std::ostream&
operator<<( std::ostream& s, const cool::ChannelSelection::Order& order )
{
return s << (int)order;
}
#endif
/// Constructor to (implicitly) select IOVs from *all* channels
/// with the given order (default is 'order by channel, since').
explicit ChannelSelection( const Order& order = channelBeforeSince );
explicit ChannelSelection( const Order& order = Order::channelBeforeSince );
/// Constructor to select IOVs for a given channel. This constructor is
/// intended to be used to autoconvert ChannelId to a ChannelSelection.
......@@ -85,11 +101,11 @@ namespace cool
/// with the given order (default is 'order by channel, since').
ChannelSelection( const ChannelId& firstChannel,
const ChannelId& lastChannel,
const Order& order = channelBeforeSince );
const Order& order = Order::channelBeforeSince );
/// Constructor to select IOVs with a given channel name.
ChannelSelection( const std::string& channelName,
const Order& order = channelBeforeSince );
const Order& order = Order::channelBeforeSince );
/// Returns true if selecting all channels.
bool allChannels() const;
......@@ -107,7 +123,7 @@ namespace cool
/// Construct a selection to select *all* channels with the given order.
static const
ChannelSelection all( const Order& order = channelBeforeSince );
ChannelSelection all( const Order& order = Order::channelBeforeSince );
/// Returns true if the given channel is in the selection
bool inSelection( const ChannelId& channel ) const;
......
// $Id: CompositeSelection.h,v 1.8 2009-12-17 18:50:42 avalassi Exp $
#ifndef COOLKERNEL_COMPOSITESELECTION_H
#define COOLKERNEL_COMPOSITESELECTION_H 1
// First of all, set/unset CORAL290, COOL300, COOL400 and COOL_HAS_CPP11 macros
#include "CoolKernel/VersionInfo.h"
// Include files
#ifdef COOL400CPP11ENUM
#include <ostream>
#endif
#include <vector>
#include "CoolKernel/IRecordSelection.h"
......@@ -26,7 +31,18 @@ namespace cool
public:
/// Logical connectives (logical operations).
#ifndef COOL400CPP11ENUM
enum Connective { AND, OR };
#else
enum class Connective { AND, OR };
// Overloaded operator<< for cool::CompositeSelection::Connective
inline friend std::ostream&
operator<<( std::ostream& s, const cool::CompositeSelection::Connective& c )
{
return s << (int)c;
}
#endif
/// Describe a logical connective.
static const std::string describe( Connective conn );
......
// $Id: FieldSelection.h,v 1.16 2009-12-17 18:50:42 avalassi Exp $
#ifndef COOLKERNEL_FIELDSELECTION_H
#define COOLKERNEL_FIELDSELECTION_H 1
// First of all, set/unset CORAL290, COOL300, COOL400 and COOL_HAS_CPP11 macros
#include "CoolKernel/VersionInfo.h"
// Include files
#ifdef COOL400CPP11ENUM
#include <ostream>
#endif
#include "CoolKernel/FieldSpecification.h"
#include "CoolKernel/IRecordSelection.h"
#include "CoolKernel/Record.h"
......@@ -26,10 +31,32 @@ namespace cool
public:
/// Binary relation operator (comparison to a reference value).
#ifndef COOL400CPP11ENUM
enum Relation { EQ, NE, GT, GE, LT, LE };
#else
enum class Relation { EQ, NE, GT, GE, LT, LE };
// Overloaded operator<< for cool::FieldSelection::Relation
inline friend std::ostream&
operator<<( std::ostream& s, const cool::FieldSelection::Relation& rel )
{
return s << (int)rel;
}
#endif
/// Unary nullness operator (comparison to NULL).
#ifndef COOL400CPP11ENUM
enum Nullness { IS_NULL, IS_NOT_NULL };
#else
enum class Nullness { IS_NULL, IS_NOT_NULL };
// Overloaded operator<< for cool::FieldSelection::Nullness
inline friend std::ostream&
operator<<( std::ostream& s, const cool::FieldSelection::Nullness& nul )
{
return s << (int)nul;
}
#endif
/// Describe a binary relation operator.
static const std::string describe( Relation relation );
......
#ifndef COOLKERNEL_FOLDERSPECIFICATION_H
#define COOLKERNEL_FOLDERSPECIFICATION_H 1
// First of all, enable or disable the COOL290 API extensions (bug #92204)
// First of all, set/unset CORAL290, COOL300, COOL400 and COOL_HAS_CPP11 macros
#include "CoolKernel/VersionInfo.h"
// Include files
......@@ -58,7 +58,7 @@ namespace cool
explicit
FolderSpecification( FolderVersioning::Mode mode,
const IRecordSpecification& payloadSpecification,
PayloadMode::Mode payloadMode = PayloadMode::INLINEPAYLOAD );
PayloadMode::Mode payloadMode = PayloadMode::Mode::INLINEPAYLOAD );
/*
/// Constructor from versioning mode and payload specification.
......
// $Id: FolderVersioning.h,v 1.2 2009-12-16 17:41:24 avalassi Exp $
#ifndef COOLKERNEL_FOLDERVERSIONING_H
#define COOLKERNEL_FOLDERVERSIONING_H
#define COOLKERNEL_FOLDERVERSIONING_H 1
namespace cool {
// First of all, set/unset CORAL290, COOL300, COOL400 and COOL_HAS_CPP11 macros
#include "CoolKernel/VersionInfo.h"
// Include files
#ifdef COOL400CPP11ENUM
#include <ostream>
#endif
namespace cool
{
/** @file FolderVersioning.h
*
......@@ -20,9 +28,20 @@ namespace cool {
// Folder versioning mode.
namespace FolderVersioning
{
#ifndef COOL400CPP11ENUM
enum Mode { NONE=-1, SINGLE_VERSION=0, MULTI_VERSION };
#else
enum class Mode { NONE=-1, SINGLE_VERSION=0, MULTI_VERSION };
// Overloaded operator<< for cool::FolderVersioning::Mode
inline std::ostream&
operator<<( std::ostream& s, const cool::FolderVersioning::Mode& mode )
{
return s << (int)mode;
}
#endif
}
}
#endif
#endif // COOLKERNEL_FOLDERVERSIONING_H
// $Id: HvsTagLock.h,v 1.3 2009-12-16 17:41:24 avalassi Exp $
#ifndef COOLKERNEL_HVSTAGLOCK_H
#define COOLKERNEL_HVSTAGLOCK_H
#define COOLKERNEL_HVSTAGLOCK_H 1
namespace cool {
// First of all, set/unset CORAL290, COOL300, COOL400 and COOL_HAS_CPP11 macros
#include "CoolKernel/VersionInfo.h"
// Include files
#ifdef COOL400CPP11ENUM
#include <ostream>
#endif
namespace cool
{
/** @file HvsTagLock.h
*
......@@ -15,9 +23,20 @@ namespace cool {
// HVS tag lock status.
namespace HvsTagLock
{
#ifndef COOL400CPP11ENUM
enum Status { UNLOCKED=0, LOCKED=1, PARTIALLYLOCKED=2 };
#else
enum class Status { UNLOCKED=0, LOCKED=1, PARTIALLYLOCKED=2 };
// Overloaded operator<< for cool::HvsTagLock::Status
inline std::ostream&
operator<<( std::ostream& s, const cool::HvsTagLock::Status& status )
{
return s << (int)status;
}
#endif
}
}
#endif
#endif // COOLKERNEL_HVSTAGLOCK_H
// $Id: IDatabase.h,v 1.92 2012-07-08 20:02:33 avalassi Exp $
#ifndef COOLKERNEL_IDATABASE_H
#define COOLKERNEL_IDATABASE_H 1
// First of all, enable or disable the COOL290 API extensions (see bug #92204)
// First of all, set/unset CORAL290, COOL300, COOL400 and COOL_HAS_CPP11 macros
#include "CoolKernel/VersionInfo.h"
// Include files
......@@ -112,7 +111,7 @@ namespace cool
( const std::string& fullPath,
const IRecordSpecification & payloadSpec,
const std::string& description = "",
FolderVersioning::Mode mode = FolderVersioning::SINGLE_VERSION,
FolderVersioning::Mode mode = FolderVersioning::Mode::SINGLE_VERSION,
bool createParents = false ) ) = 0;
/// Does this folder exist?
......
......@@ -134,6 +134,7 @@ namespace cool
/// DEPRECATED - added for easier compatibility with COOL 1.3
/// (this is likely to be removed in a future COOL release).
/// Use it instead with cool::Record (not coral::AttributeList) arguments!
COOL_DEPRECATED
( virtual void storeObject( const ValidityKey & since,
const ValidityKey & until,
......
// $Id: IHvsNode.h,v 1.45 2013-04-18 15:12:25 avalassi Exp $
#ifndef COOLKERNEL_IHVSNODE_H
#define COOLKERNEL_IHVSNODE_H 1
// First of all, enable or disable the COOL290 API extensions (see bug #92204)
// First of all, set/unset CORAL290, COOL300, COOL400 and COOL_HAS_CPP11 macros
#include "CoolKernel/VersionInfo.h"
// Include files
#include <algorithm>
#ifdef COOL400CPP11ENUM
#include <ostream>
#endif
#include <vector>
#include "CoolKernel/IHvsNodeRecord.h"
#include "CoolKernel/HvsTagLock.h"
......@@ -35,7 +37,18 @@ namespace cool
/// HVS node type: inner node (node that can have children, even if it
/// currently has none) or leaf node (node that cannot have children).
#ifndef COOL400CPP11ENUM
typedef enum { INNER_NODE=0, LEAF_NODE } Type;
#else
typedef enum class { INNER_NODE=0, LEAF_NODE } Type;
// Overloaded operator<< for cool::IHvsNode::Type
inline friend std::ostream&
operator<<( std::ostream& s, const cool::IHvsNode::Type& type )
{
return s << (int)type;
}
#endif
public:
......
// $Id: MessageLevels.h,v 1.3 2009-12-16 17:41:24 avalassi Exp $
#ifndef COOLKERNEL_MESSAGELEVELS_H
#define COOLKERNEL_MESSAGELEVELS_H 1
......@@ -35,6 +34,7 @@ namespace cool
namespace MSG
{
// This is not (yet?) a c++11 enum class
enum Level {
NIL = 0,
VERBOSE,
......
// $Id: PayloadMode.h,v 1.6 2012-07-08 20:02:33 avalassi Exp $
#ifndef COOLKERNEL_PAYLOADMODE_H
#define COOLKERNEL_PAYLOADMODE_H 1
// First of all, enable or disable the COOL290 API extensions (bug #92204)
// First of all, set/unset CORAL290, COOL300, COOL400 and COOL_HAS_CPP11 macros
#include "CoolKernel/VersionInfo.h"
#ifdef COOL290VP
// Include files
#ifdef COOL400CPP11ENUM
#include <ostream>
#endif
namespace cool
{
......@@ -31,9 +35,21 @@ namespace cool
// [values are chosen to ease backward compatibility - see bug #103351]
namespace PayloadMode
{
#ifndef COOL400CPP11ENUM
enum Mode { INLINEPAYLOAD=0, SEPARATEPAYLOAD=1, VECTORPAYLOAD=2 };
#else
enum class Mode { INLINEPAYLOAD=0, SEPARATEPAYLOAD=1, VECTORPAYLOAD=2 };
// Overloaded operator<< for cool::PayloadMode::Mode
inline std::ostream&
operator<<( std::ostream& s, const cool::PayloadMode::Mode& mode )
{
return s << (int)mode;
}
#endif
}
}
#endif
#endif // COOLKERNEL_PAYLOADMODE_H
// $Id: RecordException.h,v 1.18 2010-09-17 13:45:56 avalassi Exp $
#ifndef COOLKERNEL_RECORDEXCEPTION_H
#define COOLKERNEL_RECORDEXCEPTION_H 1
......@@ -409,7 +408,7 @@ namespace cool {
msg << "Validation";
if ( expectedName != "" ) msg << " of variable '" << expectedName << "'";
msg << " against StorageType '"
<< StorageType::storageType( StorageType::UInt63 ).name()
<< StorageType::storageType( StorageType::TypeId::UInt63 ).name()
<< "' failed: data value " << value << " is invalid"
<< " (allowed range: [" << UInt63Min << ", " << UInt63Max << "])";
setMessage( msg.str() );
......@@ -554,7 +553,7 @@ namespace cool {
msg << "Validation";
if ( expectedName != "" ) msg << " of variable '" << expectedName << "'";
msg << " against StorageType '"
<< StorageType::storageType( StorageType::Float ).name()
<< StorageType::storageType( StorageType::TypeId::Float ).name()
<< "' failed: float is Not a Number (NaN)";
setMessage( msg.str() );
}
......@@ -589,7 +588,7 @@ namespace cool {
msg << "Validation";
if ( expectedName != "" ) msg << " of variable '" << expectedName << "'";
msg << " against StorageType '"
<< StorageType::storageType( StorageType::Double ).name()
<< StorageType::storageType( StorageType::TypeId::Double ).name()
<< "' failed: double is Not a Number (NaN)";
setMessage( msg.str() );
}
......
// $Id: StorageType.h,v 1.19 2009-12-16 17:41:24 avalassi Exp $
#ifndef COOLKERNEL_STORAGETYPE_H
#define COOLKERNEL_STORAGETYPE_H 1
// First of all, set/unset CORAL290, COOL300, COOL400 and COOL_HAS_CPP11 macros
#include "CoolKernel/VersionInfo.h"
// Include files
#ifdef COOL400CPP11ENUM
#include <ostream>
#endif
#include <string>
#include <typeinfo>
......@@ -39,7 +44,12 @@ namespace cool
/// Full list of the storage types supported by COOL.
/// For each storage type, the corresponding typedef to a C++ type is
/// included in the types.h header file (e.g. typedef bool cool::Bool).
enum TypeId {
#ifndef COOL400CPP11ENUM
enum TypeId
#else
enum class TypeId
#endif
{
Bool,
//Char, // not (yet?) supported
UChar,
......@@ -60,6 +70,15 @@ namespace cool
Blob16M
};
#ifdef COOL400CPP11ENUM
// Overloaded operator<< for cool::StorageType::TypeId
inline friend std::ostream&
operator<<( std::ostream& s, const cool::StorageType::TypeId& id )
{
return s << (int)id;
}
#endif
public:
virtual ~StorageType() {}
......
// $Id: VersionInfo.h,v 1.19 2013-07-02 21:38:06 avalassi Exp $
#ifndef COOLKERNEL_VERSIONINFO_H
#define COOLKERNEL_VERSIONINFO_H 1
// Explicitly disable COOL400 extensions (do not allow -D to enable them)
#undef COOL400 // COOL 2.x or COOL 3.x
#undef COOL400CPP11ENUM // API changes for c++11 enum class (bug #103344)
// These switches are now hardcoded in the three branches of the code
// tagged as COOL-preview, COOL_2_8-patches, COOL_3_0-preview (bug #92204).
......@@ -68,7 +68,7 @@
// Sanity check: does this compiler support c++11?
#ifdef COOL_HAS_CPP11
#if ( ! defined(__GXX_EXPERIMENTAL_CXX0X__) ) && (__cplusplus < 201103L )
#error("ERROR: COOL_HAS_CPP11 but this compiler does not support c++11")
#error ("ERROR: COOL_HAS_CPP11 but this compiler does not support c++11")
#endif
#endif
......@@ -78,7 +78,7 @@
#if defined(__clang__) || defined(__GNUC__)
#define COOL_DEPRECATED(func) func __attribute__ ((deprecated))
#else
#error("ERROR: You need to implement COOL_DEPRECATED for this compiler")
#error ("ERROR: You need to implement COOL_DEPRECATED for this compiler")
#endif
#else
// NB Do not warn about API deprecations in the COOL28x API!
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment