dcparser: Add BUILDING_DIRECT_DCPARSER switch

Resolves GH #342.
This commit is contained in:
Sam Edwards 2018-08-15 20:38:00 -06:00
parent 06f7da5215
commit 97d6d84ade
25 changed files with 37 additions and 23 deletions

View File

@ -23,7 +23,7 @@
* parameter type accepts an arbitrary (or possibly fixed) number of nested
* fields, all of which are of the same type.
*/
class DCArrayParameter : public DCParameter {
class EXPCL_DIRECT_DCPARSER DCArrayParameter : public DCParameter {
public:
DCArrayParameter(DCParameter *element_type,
const DCUnsignedIntRange &size = DCUnsignedIntRange());

View File

@ -27,7 +27,7 @@
* This defines an interface to the Distributed Class, and is always
* implemented as a remote procedure method.
*/
class DCAtomicField : public DCField {
class EXPCL_DIRECT_DCPARSER DCAtomicField : public DCField {
public:
DCAtomicField(const std::string &name, DCClass *dclass, bool bogus_field);
virtual ~DCAtomicField();

View File

@ -41,7 +41,7 @@ class DCParameter;
/**
* Defines a particular DistributedClass as read from an input .dc file.
*/
class DCClass : public DCDeclaration {
class EXPCL_DIRECT_DCPARSER DCClass : public DCDeclaration {
public:
DCClass(DCFile *dc_file, const std::string &name,
bool is_struct, bool bogus_class);

View File

@ -23,7 +23,7 @@ class DCClass;
* This represents a class (or struct) object used as a parameter itself.
* This means that all the fields of the class get packed into the message.
*/
class DCClassParameter : public DCParameter {
class EXPCL_DIRECT_DCPARSER DCClassParameter : public DCParameter {
public:
DCClassParameter(const DCClass *dclass);
DCClassParameter(const DCClassParameter &copy);

View File

@ -26,7 +26,7 @@ class DCSwitch;
* only purpose is so that classes and typedefs can be stored in one list
* together so they can be ordered correctly on output.
*/
class DCDeclaration {
class EXPCL_DIRECT_DCPARSER DCDeclaration {
public:
virtual ~DCDeclaration();

View File

@ -34,7 +34,7 @@ class HashGenerator;
/**
* A single field of a Distributed Class, either atomic or molecular.
*/
class DCField : public DCPackerInterface, public DCKeywordList {
class EXPCL_DIRECT_DCPARSER DCField : public DCPackerInterface, public DCKeywordList {
public:
DCField();
DCField(const std::string &name, DCClass *dclass);

View File

@ -29,7 +29,7 @@ class DCDeclaration;
* Represents the complete list of Distributed Class descriptions as read from
* a .dc file.
*/
class DCFile {
class EXPCL_DIRECT_DCPARSER DCFile {
PUBLISHED:
DCFile();
~DCFile();

View File

@ -25,7 +25,7 @@ class HashGenerator;
* define a communication property associated with a field, for instance
* "broadcast" or "airecv".
*/
class DCKeyword : public DCDeclaration {
class EXPCL_DIRECT_DCPARSER DCKeyword : public DCDeclaration {
public:
DCKeyword(const std::string &name, int historical_flag = ~0);
virtual ~DCKeyword();

View File

@ -23,7 +23,7 @@ class HashGenerator;
* This is a list of keywords (see DCKeyword) that may be set on a particular
* field.
*/
class DCKeywordList {
class EXPCL_DIRECT_DCPARSER DCKeywordList {
public:
DCKeywordList();
DCKeywordList(const DCKeywordList &copy);

View File

@ -25,7 +25,7 @@ class DCParameter;
* This represents a combination of two or more related atomic fields, that
* will often be treated as a unit.
*/
class DCMolecularField : public DCField {
class EXPCL_DIRECT_DCPARSER DCMolecularField : public DCField {
public:
DCMolecularField(const std::string &name, DCClass *dclass);

View File

@ -23,7 +23,7 @@
* to constrain simple numeric types, as well as array sizes.
*/
template <class NUM>
class DCNumericRange {
class EXPCL_DIRECT_DCPARSER DCNumericRange {
public:
typedef NUM Number;

View File

@ -19,7 +19,7 @@
/**
* This is a block of data that receives the results of DCPacker.
*/
class DCPackData {
class EXPCL_DIRECT_DCPARSER DCPackData {
PUBLISHED:
INLINE DCPackData();
INLINE ~DCPackData();

View File

@ -31,7 +31,7 @@ class DCSwitchParameter;
* See also direct/src/doc/dcPacker.txt for a more complete description and
* examples of using this class.
*/
class DCPacker {
class EXPCL_DIRECT_DCPARSER DCPacker {
PUBLISHED:
DCPacker();
~DCPacker();

View File

@ -26,7 +26,7 @@ class DCSwitchParameter;
* requested from a particular field; its ownership is retained by the field
* so it must not be deleted.
*/
class DCPackerCatalog {
class EXPCL_DIRECT_DCPARSER DCPackerCatalog {
private:
DCPackerCatalog(const DCPackerInterface *root);
DCPackerCatalog(const DCPackerCatalog &copy);

View File

@ -64,7 +64,7 @@ END_PUBLISH
* Normally these methods are called only by the DCPacker object; the user
* wouldn't normally call these directly.
*/
class DCPackerInterface {
class EXPCL_DIRECT_DCPARSER DCPackerInterface {
public:
DCPackerInterface(const std::string &name = std::string());
DCPackerInterface(const DCPackerInterface &copy);

View File

@ -32,7 +32,7 @@ class HashGenerator;
* This may also be a typedef reference to another type, which has the same
* properties as the referenced type, but a different name.
*/
class DCParameter : public DCField {
class EXPCL_DIRECT_DCPARSER DCParameter : public DCField {
protected:
DCParameter();
DCParameter(const DCParameter &copy);

View File

@ -43,7 +43,7 @@ extern DCFile *dc_file;
// that has member functions in a union), so we'll use a class instead. That
// means we need to declare it externally, here.
class DCTokenType {
class EXPCL_DIRECT_DCPARSER DCTokenType {
public:
union U {
int s_int;

View File

@ -25,7 +25,7 @@
* divisor, which is meaningful only for the numeric type elements (and
* represents a fixed-point numeric convention).
*/
class DCSimpleParameter : public DCParameter {
class EXPCL_DIRECT_DCPARSER DCSimpleParameter : public DCParameter {
public:
DCSimpleParameter(DCSubatomicType type, unsigned int divisor = 1);
DCSimpleParameter(const DCSimpleParameter &copy);

View File

@ -27,7 +27,7 @@ class DCField;
* and represents two or more alternative unpacking schemes based on the first
* field read.
*/
class DCSwitch : public DCDeclaration {
class EXPCL_DIRECT_DCPARSER DCSwitch : public DCDeclaration {
public:
DCSwitch(const std::string &name, DCField *key_parameter);
virtual ~DCSwitch();

View File

@ -23,7 +23,7 @@ class DCSwitch;
* This represents a switch object used as a parameter itself, which packs the
* appropriate fields of the switch into the message.
*/
class DCSwitchParameter : public DCParameter {
class EXPCL_DIRECT_DCPARSER DCSwitchParameter : public DCParameter {
public:
DCSwitchParameter(const DCSwitch *dswitch);
DCSwitchParameter(const DCSwitchParameter &copy);

View File

@ -23,7 +23,7 @@ class DCParameter;
* This represents a single typedef declaration in the dc file. It assigns a
* particular type to a new name, just like a C typedef.
*/
class DCTypedef : public DCDeclaration {
class EXPCL_DIRECT_DCPARSER DCTypedef : public DCDeclaration {
public:
DCTypedef(DCParameter *parameter, bool implicit = false);
DCTypedef(const std::string &name);

View File

@ -70,6 +70,11 @@
#define END_PUBLISH
#define BLOCKING
// These control the declspec(dllexport/dllimport) on Windows. When compiling
// outside of Panda, we assume we aren't part of a DLL.
#define EXPCL_DIRECT_DCPARSER
#define EXPTP_DIRECT_DCPARSER
// Panda defines some assert-type macros. We map those to the standard assert
// macro outside of Panda.
#define nassertr(condition, return_value) assert(condition)

View File

@ -20,7 +20,7 @@
/**
* This class generates an arbitrary hash number from a sequence of ints.
*/
class HashGenerator {
class EXPCL_DIRECT_DCPARSER HashGenerator {
public:
HashGenerator();

View File

@ -30,7 +30,7 @@ typedef std::vector<int> vector_int;
* For a given integer n, it will return the nth prime number. This will
* involve a recompute step only if n is greater than any previous n.
*/
class PrimeNumberGenerator {
class EXPCL_DIRECT_DCPARSER PrimeNumberGenerator {
public:
PrimeNumberGenerator();

View File

@ -18,6 +18,7 @@
/* BUILDING_DIRECT is just a buildsystem shortcut for all of these: */
#ifdef BUILDING_DIRECT
#define BUILDING_DIRECT_DCPARSER
#define BUILDING_DIRECT_DEADREC
#define BUILDING_DIRECT_DIRECTD
#define BUILDING_DIRECT_INTERVAL
@ -26,6 +27,14 @@
#define BUILDING_DIRECT_DISTRIBUTED
#endif
#ifdef BUILDING_DIRECT_DCPARSER
#define EXPCL_DIRECT_DCPARSER EXPORT_CLASS
#define EXPTP_DIRECT_DCPARSER EXPORT_TEMPL
#else
#define EXPCL_DIRECT_DCPARSER IMPORT_CLASS
#define EXPTP_DIRECT_DCPARSER IMPORT_TEMPL
#endif
#ifdef BUILDING_DIRECT_DEADREC
#define EXPCL_DIRECT_DEADREC EXPORT_CLASS
#define EXPTP_DIRECT_DEADREC EXPORT_TEMPL