Easy API

Based on these EPICSv3 designs: Features: API:

ChannelRPC Example

Where MakeNameValue returns a PVStructure shared_pointer
// scalar
string name = "archiver";
shared_ptr < PVStructure > output = ChannelRPC(name, MakeNameValue("t0", 45045254, "channel", "current"));

// vectorized (eg. useful for querying mulitple devices)
vector < string > names;
names.push_back("archiver1");
names.push_back("archiver2");
vector < shared_ptr < PVStructure > > inputs;
inputs.push_back(MakeNameValue("t0", 45045254, "channel", "current"));
inputs.push_back(MakeNameValue("t0", 45045254, "channel", "vacuum"));
vector < shared_ptr < PVStructure > > outputs = ChannelRPC(names, inputs);

Value Types

User must be able to provide doubles, double arrays, strings or any PVStructure.

Problems

The Easy API breaks the pvAccess container model (apart from ChannelRPC). The user does NOT want to do this:
pvstructures = ChannelPutConnect(names)
modify(pvstructures)
results = ChannelPutPut(names, pvstructures)
The user wants to do this:
pvstructures = make_some_pvstructures_at_my_leisure()
# type check when trying to put
results = ChannelPut(names, pvstructures)
Or possibly:
pvstructures = ChannelPutReturnPrototypes(names)
modify(pvstructures)
results = ChannelPut(names, pvstructures)

One way to do this is by copying the user's PVStructure into the channel's PVStructure field by field. Alternatively the user's PVStructure can be type-checked and serialized (this needs a modification to the PVAccess API).

As most applications will use ChannelRPC or primitive types, copying will be ok for a prototype.

Solutions for copying get results

A free list of PVStructures will allow the user to hold on to a copy of of the get result without allocating on every get
result = ChannelGet(name)

// ChannelGet internals
if len(freelist) > 0:
  pvstructure = freelist.pop()
else:
  pvstructure = PVStructureFactory.create(channel.type)

get_into(pvstructure)
return pvstructure

// result pointer destructor puts the structure back on the free list