Hi. I declared the attribute with static modifier in header file as follows:
* private:
static Fetcher_map active_fetchers;*
But it doesn't compile when I put the static modifier.
This accessed in .cc file in different methods and initialized. But when it
is accessed in methods called by event handlers, as flow_stats_in, it seems
that another instance of active_fetcher is created, because it size is zero.
So I would like to know if I am using the correct modifier or if I can have
the same instance of class some other manner, without using modifiers.
Thank you so much.
2011/2/18 Murphy McCauley <[email protected]>
> You say you tried to use the static modifier but it didn't work. Could you
> explain a bit more what you mean by "didn't work"? Didn't compile? Didn't
> have the expected results? Also, a short code snippet might be helpful.
>
> -- Murphy
>
> On Feb 17, 2011, at 4:37 PM, Ricardo Bennesby wrote:
>
> Hi all,
>
> I am developing a component using C++ and I am having the following
> problem:
> In header file, in the definition of a class, I declared an attribute and I
> want that this attribute belongs to the class and not to a instance of this
> class.
> I tried to use static modifier but it didn't work.
> It seems to me that handlers of events create different instances of the
> class. For example, the method *handle_flow_stats_in *inserts elements in
> a object of the type Fetcher_map but the *handle_datapath_join *indicates
> that the size of object is still zero.
>
> Sorry if I didn't make myself clear.
>
> Any suggestions?
>
> --
> Ricardo Bennesby da Silva
> Ciência da Computação - UFAM
> LabCIA - Laboratório de Computação Inteligente e Autonômica
>
> _______________________________________________
> nox-dev mailing list
> [email protected]
> http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
>
>
>
--
Ricardo Bennesby da Silva
Ciência da Computação - UFAM
LabCIA - Laboratório de Computação Inteligente e Autonômica
_______________________________________________
nox-dev mailing list
[email protected]
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org