Update of /cvsroot/pclasses/pclasses2/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8043/test
Modified Files:
FactoryTest.cpp Makefile.toc
Log Message:
Mass commit: build fixes. Can now build tests using proper configure steps, at least on linux systems.
Index: FactoryTest.cpp
===================================================================
RCS file: /cvsroot/pclasses/pclasses2/test/FactoryTest.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- FactoryTest.cpp 24 Dec 2004 19:26:41 -0000 1.3
+++ FactoryTest.cpp 24 Dec 2004 23:06:27 -0000 1.4
@@ -7,78 +7,11 @@
#include <string>
#include <cassert>
-#include <pclasses/Factory.h>
-#include <pclasses/Plugin/Plugin.h>
-
-
-#ifndef CERR
-#define CERR std::cerr << __FILE__ << ":" << std::dec << __LINE__ << " : "
-#endif
-
-struct TheBase
-{
-
- virtual ~TheBase() {}
- virtual std::string classname() const = 0;
-};
-
-struct AType : public TheBase
-{
- AType()
- {
- CERR << "AType()\n";
- }
- virtual ~AType()
- {
- CERR << "~AType()\n";
- }
-
- virtual std::string classname() const { return "AType"; }
-
-};
-
-struct BType : public AType
-{
- BType()
- {
- CERR << "BType()\n";
- }
- virtual ~BType()
- {
- CERR << "~BType()\n";
- }
- virtual std::string classname() const { return "BType"; }
-};
-
-struct CType : public BType
-{
- CType()
- {
- CERR << "CType()\n";
- }
- virtual ~CType()
- {
- CERR << "~CType()\n";
- }
- virtual std::string classname() const { return "CType"; }
-};
+#include "FactoryTest.h"
-#define PFACREG_TYPE AType
-#define PFACREG_TYPE_INTERFACE TheBase
-// #define PFACREG_TYPE_IS_ABSTRACT // define to install a null factory for AType
-#define PFACREG_TYPE_NAME "AType"
-#include <pclasses/FactoryReg.h>
-
-#define PFACREG_TYPE BType
-#define PFACREG_TYPE_INTERFACE TheBase
-#define PFACREG_TYPE_NAME "BType"
-#include <pclasses/FactoryReg.h>
+#include <pclasses/Plugin/Plugin.h>
-#define PFACREG_TYPE CType
-#define PFACREG_TYPE_INTERFACE TheBase
-#define PFACREG_TYPE_NAME "CType"
-#include <pclasses/FactoryReg.h>
int main( int argc, char ** argv )
@@ -87,6 +20,7 @@
TheBase * a = 0;
+
#define CLOAD(CN) a = P::CL::classload<TheBase>( CN ); \
CERR << CN << " classload()ed? == " << a << "\n"; \
if( a ) CERR << "classname="<<a->classname()<<"\n"; \
@@ -94,15 +28,27 @@
/*************************
Can't test until linking the libpclasses_xxx works.
+ *************************/
typedef P::Plugin::PluginManager<TheBase> PM;
+
PM & pm = PM::instance();
+
#define PLOAD(CN) a = pm.create( CN ); \
CERR << CN << " plugin-create()ed? == " << a << "\n"; \
if( a ) CERR << "classname="<<a->classname()<<"\n"; \
delete( a ); a = 0;
- *************************/
-#define LOAD(CN) CLOAD(CN)
+#define LOAD(CN) CLOAD(CN); PLOAD(CN);
+
+ try
+ {
+ pm.addPlugin( "CType" );
+ // throw P::Exception( "Foo!", P_SOURCEINFO );
+ }
+ catch( const ::P::Exception & ex )
+ {
+ CERR << "Exception:\n"<<ex.where()<<"\n"<<ex.what()<<"\n";
+ }
LOAD("TheBase");
LOAD("AType");
Index: Makefile.toc
===================================================================
RCS file: /cvsroot/pclasses/pclasses2/test/Makefile.toc,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Makefile.toc 24 Dec 2004 19:26:41 -0000 1.3
+++ Makefile.toc 24 Dec 2004 23:06:28 -0000 1.4
@@ -27,13 +27,26 @@
build_bins = 1
ifeq (1,$(build_bins))
- BIN_PROGRAMS = FactoryTest
+ BIN_PROGRAMS = FactoryTest PtrTest
+ BIN_PROGRAMS_LDADD = $(LIBP_TESTS_LDADD)
+# Can't do these until i get the linker flags imported via toc:
+# PtrTest
FactoryTest_bin_OBJECTS = FactoryTest.o
+ FactoryTest_bin_LDADD = $(LIBPSYSTEM_CLIENT_LDADD)
+# $(LIBPSYSTEM_CLIENT_LDADD)
+ PtrTest_bin_OBJECTS = PtrTest.o
+ PtrTest_bin_LDADD = $(LIBPSYSTEM_CLIENT_LDADD)
# $(top_srcdir)/src/System/PathFinder.o $(wildcard $(top_srcdir)/src/System/SharedLib*.o)
include $(TOC_MAKESDIR)/BIN_PROGRAMS.make
# INSTALL_BINS += $(BIN_PROGRAMS)
# Run target BIN_PROGRAMS to build these.
endif
-all: BIN_PROGRAMS
+SHARED_LIBS = CType
+SHARED_LIBS_LDADD = $(LIBP_TESTS_LDADD)
+CType_so_OBJECTS = CType.o
+include $(TOC_MAKESDIR)/SHARED_LIBS.make
+
+
+all: SHARED_LIBS BIN_PROGRAMS
|