I am new to Abaqus C++ API and have question about the syntax.
db_Odb& odb = openOdb("file.odb");
odb_Step& step = odb.steps()["Step-1"];
odb_Instance& instance =
odb.rootAssembly().instances()["PART-1-1"];
There are several instances that the syntax is something like odb.steps()["Step-1"]
.
My question is in odb.steps()["Step-1"]
:
odb
an object?steps()
a method of the object?steps()["str"]
? I did not see that in regular C++ syntax.To answer your questions: Yes, yes, and index operator. It is all standard C++ syntax.
Without knowing the library in question at all, the class might look something like this:
class db_Odb
{
public:
std::unordered_map< std::string, odb_Step >& steps();
// ...
};
So odb.steps()
returns an indexable object (here I've used a hash map), and then we look up the key in it by appending ["Step-1"]
, which calls the map's index operator and returns a reference to a single odb_Step
instance in that map.