[phosphor-logging] Entry Class Methods Mapping
Patrick Williams
patrick at stwcx.xyz
Tue Nov 23 03:52:03 AEDT 2021
On Tue, Nov 16, 2021 at 08:26:26PM +0000, Christian Choi wrote:
> Hello,
>
> I need a way to map the string representation of methods in the Entry class to the actual method itself. Right now, I am hard-coding my own map as follows:
>
> // create mapping of function name to actual function of Entry class
> typedef std::string (Entry::*entry_method_t)(std::string);
> std::map<std::string, entry_method_t> fnMap;
> fnMap["resolution"] = &Entry::resolution;
> fnMap["eventid"] = &Entry::eventId;
>
> I was wondering if there already exists some mechanism in the code that accomplishes this so I don’t have to write the code myself like I did above. I was told by someone that sdbusplus may provide a mapping like this.
I think you're looking for the setPropertyByName and getPropertyByName methods
on the sdbusplus generated classes. See
xyz/openbmc_project/Logging/Entry/server.hpp.
--
Patrick Williams
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20211122/be61acd6/attachment-0001.sig>
More information about the openbmc
mailing list