Name this design pattern

Mar 22, 2013 5 Replies

I have been finding myself using the same design pattern more and more often lately, and I'm thinking of building a little class to carry around with me and implement it (or, maybe not, 'cause it's so easy).



The design pattern is one of keeping track of and enumerating all objects of a given class. I use this for implementing menus (so I can find all the menu lines), comm-channel listeners (so I can send incoming messages to all of them), etc.



Currently I implement these with a linked list. Since I'm generally doing the work in the embedded world, and since that means that nearly every object I create gets instantiated at boot-up and never gets destroyed, it's often a "write-only" list.



So -- anyone have a name for this thingie?



Thanks.


My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com

A symbol table? It's names cross types cross pointers, right?

Les Cargill

I did this once building internal control tables at start-up time from a configuration description file. The main difference was that the various kinds of entries eventually got packed into various sequential tables -- not linked lists. The configuring code wound up calling various functions called register_this, register_that, register_the_other as it recognized a need for some kind of entry. So -- Registry?

Mel.

Paraphrasing America, "I went to the market on a pattern without name"

We are using something similar - Mostly for classes implementing device drivers, there is a "get instance" method to provide access to the third UART, or the second HDMI receiver, etc.

Roberto Waltman [ Please reply to the group, return address is invalid ]

I think it's called a collection. Or just simply linked list.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required