From 6121cb69c563de9dcf46d00d907fb68c5774884c Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 23 Nov 2015 20:09:00 +0000 Subject: Make source object a virtual base of row set --- project2/basics/caches/memoryCache.cpp | 1 + project2/cgi/cgiProgRouter.cpp | 1 + project2/common/rowSet.h | 2 +- project2/files/fsRows.cpp | 1 + project2/ice/iceRows.h | 1 + project2/ice/slice2Rows.cpp | 1 + project2/regex/regexRows.cpp | 1 + project2/sql/sqlCache.cpp | 1 + project2/sql/sqlRows.cpp | 1 + project2/streams/streamNvpRows.cpp | 1 + project2/streams/streamRows.cpp | 1 + project2/xml/xmlRawRows.cpp | 5 +++++ project2/xml/xmlRows.cpp | 1 + project2/xml/xpathRows.cpp | 1 + 14 files changed, 18 insertions(+), 1 deletion(-) diff --git a/project2/basics/caches/memoryCache.cpp b/project2/basics/caches/memoryCache.cpp index 8aaa019..8d4914b 100644 --- a/project2/basics/caches/memoryCache.cpp +++ b/project2/basics/caches/memoryCache.cpp @@ -35,6 +35,7 @@ class MemoryCache : public RowSetCache { typedef std::list DataCache; CachedRowSet(const std::vector & k) : + SourceObject(ScriptNodePtr()), RowSet(NULL), key(k), createdAt(time(NULL)), diff --git a/project2/cgi/cgiProgRouter.cpp b/project2/cgi/cgiProgRouter.cpp index 2b72652..562b922 100644 --- a/project2/cgi/cgiProgRouter.cpp +++ b/project2/cgi/cgiProgRouter.cpp @@ -197,6 +197,7 @@ NAMEDPLUGIN("progRouter", ProgRouterFactory, RouterFactory); class Routes : public RowSet { public: Routes(ScriptNodePtr s) : + SourceObject(s), RowSet(s) { } class RouteRowState : public RowState { public: diff --git a/project2/common/rowSet.h b/project2/common/rowSet.h index 5cb991e..8745c87 100644 --- a/project2/common/rowSet.h +++ b/project2/common/rowSet.h @@ -17,7 +17,7 @@ typedef boost::intrusive_ptr ConstRowSetPtr; typedef boost::function RowProcessorCallback; /// Base class for Project2 components that provide a row set representation of data -class RowSet : public SourceObject { +class RowSet : public virtual SourceObject { public: SimpleNumericException(ParentOutOfRange); SimpleMessageException(FieldDoesNotExist); diff --git a/project2/files/fsRows.cpp b/project2/files/fsRows.cpp index c67c02f..b0a2279 100644 --- a/project2/files/fsRows.cpp +++ b/project2/files/fsRows.cpp @@ -45,6 +45,7 @@ const struct stat & FsRows::SpecBase::curStat(const SearchState * fs) const { re FsRows::FsRows(ScriptNodePtr p) : + SourceObject(p), RowSet(p), root(p, "root"), spec(p, "spec", ""), diff --git a/project2/ice/iceRows.h b/project2/ice/iceRows.h index 7fcda85..3ac2019 100644 --- a/project2/ice/iceRows.h +++ b/project2/ice/iceRows.h @@ -26,6 +26,7 @@ template class IceRows : public RowSet, public IceClient { public: IceRows(ScriptNodePtr p) : + SourceObject(p), RowSet(p), IceClient(p) { diff --git a/project2/ice/slice2Rows.cpp b/project2/ice/slice2Rows.cpp index b91d158..cbc002a 100644 --- a/project2/ice/slice2Rows.cpp +++ b/project2/ice/slice2Rows.cpp @@ -44,6 +44,7 @@ Slice2Rows::visitOperation(const Slice::OperationPtr & o) fprintf(code, "\t\t\t\tpublic:\n"); // Constructor fprintf(code, "\t\t\t\t\t%s(ScriptNodePtr p) :\n", o->name().c_str()); + fprintf(code, "\t\t\t\t\t\tSourceObject(p),\n"); fprintf(code, "\t\t\t\t\t\tIceRows< ::%s::%sPrx >(p)", module.c_str(), interface.c_str()); for (const auto & p : o->parameters()) { fprintf(code, ",\n\t\t\t\t\t\t%s(p, \"%s\")", p->name().c_str(), p->name().c_str()); diff --git a/project2/regex/regexRows.cpp b/project2/regex/regexRows.cpp index 8939b2a..0ae4af4 100644 --- a/project2/regex/regexRows.cpp +++ b/project2/regex/regexRows.cpp @@ -7,6 +7,7 @@ NAMEDFACTORY("regexrows", RegexRows, RowSetFactory); RegexRows::RegexRows(ScriptNodePtr p) : + SourceObject(p), DefinedColumns(p, "columns", boost::bind(&Column::make, _1, _2)), RowSet(p), sourceText(p, "sourceText"), diff --git a/project2/sql/sqlCache.cpp b/project2/sql/sqlCache.cpp index d20a8fc..cc2b451 100644 --- a/project2/sql/sqlCache.cpp +++ b/project2/sql/sqlCache.cpp @@ -61,6 +61,7 @@ class SqlCache : public RowSetCache { class SqlCacheRowSet : public RowSet { public: SqlCacheRowSet(SelectPtr r) : + SourceObject(ScriptNodePtr()), RowSet(NULL), s(r) { } diff --git a/project2/sql/sqlRows.cpp b/project2/sql/sqlRows.cpp index b6e40cc..918a502 100644 --- a/project2/sql/sqlRows.cpp +++ b/project2/sql/sqlRows.cpp @@ -13,6 +13,7 @@ NAMEDFACTORY("sqlrows", SqlRows, RowSetFactory); SqlRows::SqlRows(ScriptNodePtr p) : + SourceObject(p), RowSet(p), dataSource(p, "datasource"), sqlCommand(p->child("sql")), diff --git a/project2/streams/streamNvpRows.cpp b/project2/streams/streamNvpRows.cpp index 01242cf..281360f 100644 --- a/project2/streams/streamNvpRows.cpp +++ b/project2/streams/streamNvpRows.cpp @@ -148,6 +148,7 @@ class StreamNvpRows : public RowSet { }; StreamNvpRows(ScriptNodePtr p) : + SourceObject(p), RowSet(p), fieldSep(p->value("fieldSep", ",", NULL).as()), quoteChar(p->value("quoteChar", "\"", NULL).as()), diff --git a/project2/streams/streamRows.cpp b/project2/streams/streamRows.cpp index a4f8aae..8e2bc82 100644 --- a/project2/streams/streamRows.cpp +++ b/project2/streams/streamRows.cpp @@ -45,6 +45,7 @@ class StreamRows : public DefinedColumns, public RowSet { }; StreamRows(ScriptNodePtr p) : + SourceObject(p), DefinedColumns(p, "columns", boost::bind(&Column::make, _1, _2)), RowSet(p), fieldSep(p->value("fieldSep", ",", NULL).as()[0]), diff --git a/project2/xml/xmlRawRows.cpp b/project2/xml/xmlRawRows.cpp index 5b46279..6c3dd3a 100644 --- a/project2/xml/xmlRawRows.cpp +++ b/project2/xml/xmlRawRows.cpp @@ -42,11 +42,13 @@ class XmlRowState : public RowState { XmlRawRowsBase::XmlRawRowsBase(ScriptNodePtr p) : + SourceObject(p), RowSet(p) { } XmlRawRowsBase::XmlRawRowsBase() : + SourceObject(ScriptNodePtr()), RowSet(NULL) { } @@ -82,12 +84,14 @@ void XmlRawRowsBase::execute(const xmlpp::Document * doc, const RowProcessorCall } XmlRawRows::XmlRawRows(ScriptNodePtr p) : + SourceObject(p), XmlRawRowsBase(p), path(p, "path") { } XmlRawRows::XmlRawRows(const Glib::ustring & p) : + SourceObject(ScriptNodePtr()), path(p) { } @@ -99,6 +103,7 @@ void XmlRawRows::execute(const Glib::ustring&, const RowProcessorCallback & rp, } XmlMemRawRows::XmlMemRawRows(boost::shared_ptr d) : + SourceObject(ScriptNodePtr()), doc(d) { } diff --git a/project2/xml/xmlRows.cpp b/project2/xml/xmlRows.cpp index 1277274..1c08159 100644 --- a/project2/xml/xmlRows.cpp +++ b/project2/xml/xmlRows.cpp @@ -13,6 +13,7 @@ NAMEDFACTORY("xmlrows", XmlRows, RowSetFactory); XmlRows::XmlRows(ScriptNodePtr p) : + SourceObject(p), RowSet(p), recordRoot(p, "recordroot"), recordTrigger(p, "recordtrigger"), diff --git a/project2/xml/xpathRows.cpp b/project2/xml/xpathRows.cpp index e09458b..01f2e13 100644 --- a/project2/xml/xpathRows.cpp +++ b/project2/xml/xpathRows.cpp @@ -15,6 +15,7 @@ SimpleMessageException(XpathInitError); SimpleMessageException(XpathEvalError); XPathRows::XPathRows(ScriptNodePtr p) : + SourceObject(p), RowSet(p), XmlDocumentCache(p), html(p, "html", false), -- cgit v1.2.3