Boost logo

Boost Users :

Subject: Re: [Boost-users] Multiple instance of options
From: Ulf Samuelsson (boost-user_at_[hidden])
Date: 2013-09-20 05:48:03


On 2013-09-20 09:34, Kerry, Richard wrote:
>
> I don't think that can work.
>
> Although I use Windows functions (GetPrivateProfileString etc) to do
> this I've had a quick look at the Boost documentation and it looks
> like what I'm about to say is the same for Boost's handing of property
> maps and ini files.
>
> You can't duplicate the [sensor] section as you then have no way of
> selecting which one you want.
>
If I look at an xorg.conf file I find:

Section "Monitor"
     Identifier "VG2021m"
     Option "DPMS"
     HorizSync 28-65
     VertRefresh 57-63
         VendorName "Viewsonic"
# More Options...
EndSection

Section "Monitor"
     Identifier "SyncMaster-245B"
     Option "DPMS"
         HorizSync 30-81
     VertRefresh 56-75
         VendorName "Samsung"
# More Options
EndSection

so it is not impossible.
The "Identifier" allows you to differentiate between the two.

> The functions take section name and key name and return a value, so if
> a section name is duplicated the system doesn't know which section you
> want.
>
> Should sensor.SensorName return "Outdoor Temp" or "Indoor Temp" ?
>
> In similar cases we do it like this :
>
> [sensor_1]
> ...
> [sensor_2]
> ...
> [sensor_3]
> ...
>
> This means you've got unique section names.
>
> "you get a hard limit"
>
> Why do you think that ?
>
> Either hold a separate value for the number of sensors, or attempt to
> read in order and stop when one is missing (this adds a rule that the
> ones you're using must be consecutive).
>

Have not read all documentation yet, but don't I have to determine
at compile time which sections that can be in the ini file.

Regards,
Ulf

> Regards,
>
> Richard.
>
> *Richard Kerry*
>
> BNCS Engineer, SI SOL Telco & Media Vertical Practice
>
> T: +44 (0)20 82259063
>
> M: +44 (0)7812 325518
>
> G300, Stadium House, Wood Lane, London, W12 7TA
>
> richard.kerry_at_[hidden]
> <https://webmail.siemens-it-solutions.com/owa/redir.aspx?C=9fb20d019e3e4cb99344d708709a3177&URL=mailto%3arichard.kerry%40atos.net>
>
> This e-mail and the documents attached are confidential and intended
> solely for the addressee; it may also be privileged. If you receive
> this e-mail in error, please notify the sender immediately and destroy
> it. As its integrity cannot be secured on the Internet, the Atos group
> liability cannot be triggered for the message content. Although the
> sender endeavours to maintain a computer virus-free network, the
> sender does not warrant that this transmission is virus-free and will
> not be liable for any damages resulting from any virus transmitte
>
> ------------------------------------------------------------------------
> *From:* Boost-users [boost-users-bounces_at_[hidden]] on behalf of
> Ulf Samuelsson [boost-user_at_[hidden]]
> *Sent:* 18 September 2013 17:28
> *To:* boost-users_at_[hidden]
> *Subject:* [Boost-users] Multiple instance of options
>
>
> Need to parse an "ini" file which configures one or more sensors.
>
> The sensors can be of the same type and are identified by
> "name", "type" and an "id"
>
> Some configuration items are for all sensors
> Other configuration tiems are only for some sensors.
>
> [sensor]
> SensorName="Outdoor Temp"
> SensorType=1 # Temp Sensor
> SensorID=1000
> SerialNumber="12344"
> Active=1
> Device="/dev/ttyUSB01"
>
> [sensor]
> SensorName="Indoor Temp"
> SensorType=1 # Temp Sensor
> SensorID=1001
> SerialNumber="12345"
> Active=1
> Device="/dev/USB02"
>
> [sensor]
> SensorName="Light"
> SensorType=2 # Light Sensor
> SensorID=1002
> SerialNumber="12349"
> Active=1
> Device="/dev/ttyUSB02"
> MaxLumen="500"
>
> Is having multiple identical section names possible with boost program
> options?
>
>
> It is of course possible to do
>
> [sensor_1]
> ...
> [sensor_2]
> ...
> [sensor_3]
> ...
>
> but that is not so nice looking,
> and you get a hard limit on the number
> of sensors you can attach.
>
>
>
> Ideas?
>
> BR
> Ulf Samuelsson
>
>
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net