pvif simplify

This commit is contained in:
Michael Davidsaver
2017-09-13 19:31:08 -05:00
parent 1676bc6601
commit b5d0678c75
3 changed files with 4 additions and 14 deletions

View File

@@ -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;

View File

@@ -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:

View File

@@ -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));