Skip to content

Commit

Permalink
Export types in typesimpl build and make Exception public
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Glustein <adam.glustein@point72.com>
  • Loading branch information
AdamGlustein committed Oct 18, 2024
1 parent 9c171f0 commit c756eb0
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 25 deletions.
2 changes: 1 addition & 1 deletion cpp/csp/core/Enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ bool UnknownOnInvalidValue(long) { return false; }

START_PACKED
template<typename EnumTraits>
struct CSPIMPL_EXPORT Enum : public EnumTraits
struct Enum : public EnumTraits
{
using EnumV = typename EnumTraits::_enum;
using Mapping = std::vector<std::string>;
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/core/EnumBitSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace csp
//Utility class to hold enums as a bitmask ( where enum values are incremental from 0 )
//enum must have a NUM_TYPES entry for number of entries
template< typename EnumT >
class CSPIMPL_EXPORT EnumBitSet
class EnumBitSet
{
using value_type = uint64_t;

Expand Down
4 changes: 2 additions & 2 deletions cpp/csp/core/Exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace csp
{

class CSPIMPL_EXPORT Exception : public std::exception
class CSP_PUBLIC Exception : public std::exception
{
public:
Exception( const char * exType, const std::string & description, const char * file, const char * func, int line ) :
Expand Down Expand Up @@ -59,7 +59,7 @@ class CSPIMPL_EXPORT Exception : public std::exception
};

#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
#define CSP_DECLARE_EXCEPTION( DerivedException, BaseException ) class CSPIMPL_EXPORT DerivedException : public BaseException { public: DerivedException( const char * exType, const std::string &r, const char * file, const char * func, int line ) : BaseException( exType, r, file, func, line ) {} };
#define CSP_DECLARE_EXCEPTION( DerivedException, BaseException ) class CSP_PUBLIC DerivedException : public BaseException { public: DerivedException( const char * exType, const std::string &r, const char * file, const char * func, int line ) : BaseException( exType, r, file, func, line ) {} };

CSP_DECLARE_EXCEPTION( AssertionError, Exception )
CSP_DECLARE_EXCEPTION( RuntimeException, Exception )
Expand Down
4 changes: 3 additions & 1 deletion cpp/csp/core/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#undef GetMessage

#define CSP_LOCAL
#define CSP_PUBLIC __declspec(dllexport)

#ifdef CSPTYPESIMPL_EXPORTS
#define CSPTYPESIMPL_EXPORT __declspec(dllexport)
Expand Down Expand Up @@ -93,6 +94,7 @@ inline uint8_t ffs(uint64_t n)
#define CSPTYPESIMPL_EXPORT __attribute__ ((visibility ("default")))

#define CSP_LOCAL __attribute__ ((visibility ("hidden")))
#define CSP_PUBLIC __attribute__ ((visibility ("default")))

#define START_PACKED
#define END_PACKED __attribute__((packed))
Expand All @@ -114,4 +116,4 @@ inline constexpr uint8_t ffs( uint64_t n ) { return __builtin_ffsl(n); }

#endif

#endif
#endif
2 changes: 1 addition & 1 deletion cpp/csp/core/QueueWaiter.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace csp

class TimeDelta;

class CSPIMPL_EXPORT QueueWaiter
class QueueWaiter
{
public:
QueueWaiter() : m_eventsPending( false )
Expand Down
10 changes: 5 additions & 5 deletions cpp/csp/core/Time.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const int64_t NANOS_PER_SECOND = 1000000000;
const int64_t SECONDS_PER_DAY = 86400;
const int64_t NANOS_PER_DAY = NANOS_PER_SECOND * SECONDS_PER_DAY;

class CSPIMPL_EXPORT TimeDelta
class CSPTYPESIMPL_EXPORT TimeDelta
{
public:
constexpr TimeDelta() : TimeDelta( TimeDelta::NONE() ) {}
Expand Down Expand Up @@ -165,7 +165,7 @@ inline std::ostream & operator <<( std::ostream &os, const TimeDelta & d )
return os;
}

class CSPIMPL_EXPORT Date
class CSPTYPESIMPL_EXPORT Date
{
public:
Date() : Date( NONE() ) {}
Expand Down Expand Up @@ -316,7 +316,7 @@ inline std::ostream & operator <<( std::ostream &os, const Date & d )
return os;
}

class CSPIMPL_EXPORT Time
class CSPTYPESIMPL_EXPORT Time
{
public:
Time() : Time( -1 ) {} //NONE
Expand Down Expand Up @@ -446,7 +446,7 @@ inline std::ostream & operator <<( std::ostream &os, const Time & t )

// Time is internally stored as an int64_t nanoseconds since 1970.
// All DateTime objects are stored as UTC and should be treated as such
class CSPIMPL_EXPORT DateTime
class CSPTYPESIMPL_EXPORT DateTime
{
public:
DateTime() : DateTime( DateTime::NONE() ) {}
Expand Down Expand Up @@ -597,7 +597,7 @@ inline std::ostream & operator <<( std::ostream &os, const DateTime & dt )
//Helper class to extract day/month/year/etc info from raw timestamp
//ie DateTimeEx dte( existingDt )
//dte.day, etc etc
class CSPIMPL_EXPORT DateTimeEx : public DateTime
class CSPTYPESIMPL_EXPORT DateTimeEx : public DateTime
{
public:
DateTimeEx( const DateTime & dt );
Expand Down
24 changes: 12 additions & 12 deletions cpp/csp/engine/Struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TypedStructPtr;

using StructPtr = TypedStructPtr<Struct>;

class CSPIMPL_EXPORT StructField
class CSPTYPESIMPL_EXPORT StructField
{
public:

Expand Down Expand Up @@ -114,7 +114,7 @@ class CSPIMPL_EXPORT StructField
using StructFieldPtr = std::shared_ptr<StructField>;

template<typename T>
class CSPIMPL_EXPORT NativeStructField : public StructField
class CSPTYPESIMPL_EXPORT NativeStructField : public StructField
{
static_assert( CspType::Type::fromCType<T>::type <= CspType::Type::MAX_NATIVE_TYPE );
static_assert( sizeof(T) == alignof(T) );
Expand Down Expand Up @@ -177,15 +177,15 @@ using TimeDeltaStructField = NativeStructField<TimeDelta>;
using DateStructField = NativeStructField<Date>;
using TimeStructField = NativeStructField<Time>;

class CSPIMPL_EXPORT CspEnumStructField final : public NativeStructField<CspEnum>
class CSPTYPESIMPL_EXPORT CspEnumStructField final : public NativeStructField<CspEnum>
{
public:
CspEnumStructField( CspTypePtr type, const std::string & fieldname ) : NativeStructField( type, fieldname )
{}
};

template<typename T>
class CSPIMPL_EXPORT NotImplementedStructField : public StructField
class CSPTYPESIMPL_EXPORT NotImplementedStructField : public StructField
{
public:
const T & value( const Struct * s ) const
Expand Down Expand Up @@ -216,7 +216,7 @@ class CSPIMPL_EXPORT NotImplementedStructField : public StructField


//Non-native fields need to have these specialized in dialect-specific code
class CSPIMPL_EXPORT NonNativeStructField : public StructField
class CSPTYPESIMPL_EXPORT NonNativeStructField : public StructField
{
public:
NonNativeStructField( CspTypePtr type, const std::string &fieldname, size_t size, size_t alignment ) :
Expand All @@ -240,7 +240,7 @@ class CSPIMPL_EXPORT NonNativeStructField : public StructField
virtual void clearValueImpl( Struct * s ) const = 0;
};

class CSPIMPL_EXPORT StringStructField final : public NonNativeStructField
class CSPTYPESIMPL_EXPORT StringStructField final : public NonNativeStructField
{
public:
using CType = csp::CspType::StringCType;
Expand Down Expand Up @@ -310,7 +310,7 @@ class CSPIMPL_EXPORT StringStructField final : public NonNativeStructField
};

template<typename CType>
class CSPIMPL_EXPORT ArrayStructField : public NonNativeStructField
class CSPTYPESIMPL_EXPORT ArrayStructField : public NonNativeStructField
{
using ElemT = typename CType::value_type;

Expand Down Expand Up @@ -419,7 +419,7 @@ class CSPIMPL_EXPORT ArrayStructField : public NonNativeStructField
}
};

class CSPIMPL_EXPORT DialectGenericStructField : public NonNativeStructField
class CSPTYPESIMPL_EXPORT DialectGenericStructField : public NonNativeStructField
{
public:
DialectGenericStructField( const std::string & fieldname, size_t size, size_t alignment ) :
Expand Down Expand Up @@ -479,7 +479,7 @@ class CSPIMPL_EXPORT DialectGenericStructField : public NonNativeStructField
};

template<typename T>
class CSPIMPL_EXPORT TypedStructPtr
class CSPTYPESIMPL_EXPORT TypedStructPtr
{
public:
TypedStructPtr() : m_obj( nullptr ) {}
Expand Down Expand Up @@ -581,7 +581,7 @@ TypedStructPtr<T> structptr_cast( const TypedStructPtr<U> & r )
return out;
}

class CSPIMPL_EXPORT StructMeta : public std::enable_shared_from_this<StructMeta>
class CSPTYPESIMPL_EXPORT StructMeta : public std::enable_shared_from_this<StructMeta>
{
public:
using Fields = std::vector<StructFieldPtr>;
Expand Down Expand Up @@ -685,7 +685,7 @@ std::shared_ptr<typename StructField::upcast<T>::type> StructMeta::getMetaField(

using StructMetaPtr = std::shared_ptr<StructMeta>;

class CSPIMPL_EXPORT Struct
class CSPTYPESIMPL_EXPORT Struct
{
public:

Expand Down Expand Up @@ -817,7 +817,7 @@ bool TypedStructPtr<T>::operator==( const TypedStructPtr<T> & rhs ) const
}

//field that is another struct
class CSPIMPL_EXPORT StructStructField final : public NonNativeStructField
class CSPTYPESIMPL_EXPORT StructStructField final : public NonNativeStructField
{
public:
StructStructField( CspTypePtr cspType, const std::string &fieldname ) :
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/engine/TickBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace csp
{

template< typename T >
class CSPIMPL_EXPORT TickBuffer
class TickBuffer
{
public:
TickBuffer( uint32_t capacity = 1 );
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/engine/WindowBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace csp
// Class declarations

template<typename T>
class CSPIMPL_EXPORT WindowBuffer
class WindowBuffer
{
public:
WindowBuffer();
Expand Down

0 comments on commit c756eb0

Please sign in to comment.