The basic c++ api tool to add nodes into the scene is MDagModifier::createNode(...). You can specify the node type to add by a string name or by its MTypeId node designation.
The devkit has a few examples. The offsetNode devkit example creates some locators.
If you want to create a new type of primitive, like defining your own mesh or something even more complex, examples like the polyPrimitiveCmd may be a better place to start.
The maya API lets you create
1. objects with components (shapes)
2. objects without components (locators)
If you want your objects be renderable by a software renderer, you would have to additionally write your specific shader node.