pvif simplify
This commit is contained in:
@@ -640,15 +640,9 @@ PVIFBuilder::PVIFBuilder()
|
||||
PVIFBuilder::~PVIFBuilder() {}
|
||||
|
||||
|
||||
PVIFBuilder* PVIFBuilder::create(const options_t& options)
|
||||
PVIFBuilder* PVIFBuilder::create(const std::string& type)
|
||||
{
|
||||
options_t::const_iterator it;
|
||||
|
||||
if((it = options.find("@type"))==options.end())
|
||||
throw std::runtime_error("Field mapping missing required key \"@type\"");
|
||||
const std::string& type(it->second.ref<std::string>());
|
||||
|
||||
if(type=="scalar")
|
||||
if(type.empty() || type=="scalar")
|
||||
return new ScalarBuilder;
|
||||
else if(type=="plain")
|
||||
return new PlainBuilder;
|
||||
|
||||
@@ -287,9 +287,7 @@ struct epicsShareClass PVIFBuilder {
|
||||
// need not be the root structure
|
||||
virtual PVIF* attach(dbChannel *channel, const epics::pvData::PVFieldPtr& root) =0;
|
||||
|
||||
typedef std::map<std::string, AnyScalar> options_t;
|
||||
|
||||
static PVIFBuilder* create(const options_t& options);
|
||||
static PVIFBuilder* create(const std::string& name);
|
||||
protected:
|
||||
PVIFBuilder();
|
||||
private:
|
||||
|
||||
@@ -230,9 +230,7 @@ void testPlain()
|
||||
|
||||
p2p::auto_ptr<PVIFBuilder> builder;
|
||||
{
|
||||
PVIFBuilder::options_t opts;
|
||||
opts["@type"] = "plain";
|
||||
builder.reset(PVIFBuilder::create(opts));
|
||||
builder.reset(PVIFBuilder::create("plain"));
|
||||
}
|
||||
|
||||
pvd::FieldConstPtr dtype_li(builder->dtype(chan_li));
|
||||
|
||||
Reference in New Issue
Block a user