Ticket #2618 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

More consistency in names/capitalization for typedef'd/Swigged STL objects

Reported by: jbosch Owned by: robyn
Priority: trivial Milestone:
Component: TCT Keywords:
Cc: robyn, mjuric, ktl, rhl, smm, rowen, RayPlante, gpdf Blocked By:
Blocking: Project: LSST
Version Number:
How to repeat:

not applicable

Description

Looking through our Swig code, I see a lot of e.g. vectorD as a wrapper for std::vector<double>. In other places it's VectorD. And then there's e.g. KernelList and SpanList, which are really typedefs to std::vector<PTR(T)>, not std::list.

I'd like a TCT ruling on what these *should* be called. I propose:

For things that have a clear meaning in a particular context, (e.g. MaskPlaneDict), use a name that describes that meaning (like MaskPlaneDict).

For containers of numeric built-ins:

[capitalized STL name][element type suffix used in afw::image]:
  std::vector<double> == VectorD
  std::list<int> == ListI

For containers of our own things:

[element class name, ignoring ptrs][capitalized STL name]:
  std::vector<PTR(Span)> == SpanVector
  std::list<Box2I> == Box2IList

However, if a container is logically a list (don't need random access) but is actually a std::vector for simplicity/performance reasons, I don't mind calling it a List, especially to preserve backwards compatibility.

Change History

comment:1 Changed 6 years ago by robyn

  • Status changed from new to assigned

TCT members: KT, Mario, Serge, Russell, and Robyn, discussed this issue on 7 Mar 2013.

KT felt that the Rule for swig containers for numeric built-ins should be STRICTLY followed; the rule for swig containers of DM-centric objects is advisory.

Russell provided a spur of the moment test case to determine the result based on the rules. He wanted to know the naming of a list of images of type D. It was determined to be: ImageDList . It was felt that was an adequate name.

All TCT members present voted to accept this Rule set.

Action Item: Robyn will add this to the DM C++ Standards document.

comment:2 Changed 6 years ago by robyn

  • Status changed from assigned to closed
  • Resolution set to fixed

Robyn added the Rules to the draft DM C++ Standards document. See: Rules 3-37 and 3-37a .

Note: See TracTickets for help on using tickets.