RE: properties, lists of properties and API access

  • From: "Sina Bahram" <sbahram@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Fri, 21 Jan 2011 18:21:01 -0500

Nothing at all.

That's what I'd do.

Except I'd throw an array in there too, because you can have more than one of 
each type of object.

Take care,
Sina

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx 
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Littlefield, Tyler
Sent: Friday, January 21, 2011 5:09 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: properties, lists of properties and API access

Thanks for the link. Though I'm not really sure what they were doing. I 
get the whole nested map question, but about 10 different solutions were 
talked about, repeated, then talked about some more with some mpl 
solutions here and there.
To clerify, what's wrong with:
std::map<std::string, std::map<std::string, val> > vals?

On 1/21/2011 2:58 PM, Sina Bahram wrote:
> I urge you to look at the discussion here:
>
> http://stackoverflow.com/questions/1500208/nested-stdmaps
>
> take care,
> Sina
>
>
> -----Original Message-----
> From: programmingblind-bounce@xxxxxxxxxxxxx 
> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Littlefield, Tyler
> Sent: Friday, January 21, 2011 4:42 PM
> To: programmingblind@xxxxxxxxxxxxx
> Subject: Re: properties, lists of properties and API access
>
> Uh. How is a static member on an airplain going to help me solve my
> problem? The goal is to store lists of properties per airplain; bob's
> plain may be different from joes. I think I found a solution though. I'm
> going to use my overloaded [] to check for a single property, then if
> that fails check for something on the property list (or just overload
> each), then rather than having a vector of maps I can have a vector of
> PropertyObjects, which the person can do whatever they want with. I
> think it'd be quicker than using double maps, anyway.
> On 1/21/2011 2:36 PM, Ken Perry wrote:
>> I think what you're looking for is a static member.  Static members of
>> classes means there is only one and they are all the same.  You can use this
>> to count how many objects of a type or set things like a global object
>> value.
>>
>> Ken
>>
>> -----Original Message-----
>> From: programmingblind-bounce@xxxxxxxxxxxxx
>> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Littlefield,
>> Tyler
>> Sent: Friday, January 21, 2011 11:57 AM
>> To: programmingblind@xxxxxxxxxxxxx
>> Subject: properties, lists of properties and API access
>>
>> Hello all,
>> I have a quick question, or maybe not so quick, after I explain.
>> Aspen's properties are what are stored that allows a coder to serialize
>> properties and access them with other components. It essentially is just
>> a hash_map<std::string, Variant>. Now, I have a bit of an issue. I'm
>> looking at building an object such as a ship, for example. Now, each
>> ship wil have multiple different weapons, so I will need a sort of
>> collection. I'm having a problem with this, because right now I can just
>> do object["hp"]=100 and it sets the hp varaint to 100. Now, if I want
>> collections I want to do something like:
>> object['weapons'][0]['damage']... Are there any solutions to setting
>> something like this up? Maybe I can just overload the [] operator on my
>> PropertyContainer class, so that it will check for the existance of a
>> variant, and if such a variant does not exist it will then proceed to
>> check for the value in the collections list?
>> Which leads me to another concern. My property list will end up looking
>> something like:
>> std::hash_map<std::string, std::vector<std::hash_map<std::string,
>> Variant>   >   >;
>> This does not seem like a great idea, at all. But I'm not really sure
>> how to set it up so that it might work faster, etc. Ideas would be welcome.
>>
>


-- 

Thanks,
Ty
http://tds-solutions.net
Peace cannot be kept by force; it can only be achieved by understanding.-- 
Albert Einstein
Live as if you were to die tomorrow. Learn as if you were to live 
forever.-gandhi
I know that you believe you understand what you think I said, but I'm not sure 
you realize that what you heard is not what I
meant.-Robert McCloskey

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: