Skip to content

Commit

Permalink
Remove default argument in definition // don't check for connectednes…
Browse files Browse the repository at this point in the history
…s when getting/setting connectee path
  • Loading branch information
nickbianco committed Dec 18, 2023
1 parent 72be8d2 commit e87c971
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion OpenSim/Common/Component.h
Original file line number Diff line number Diff line change
Expand Up @@ -3397,7 +3397,7 @@ class ConnecteeNotSpecified : public Exception {
};

template<class C>
const C& Socket<C>::getConnectee(int index=-1) const {
const C& Socket<C>::getConnectee(int index) const {
if (index < 0) {
if (!isListSocket()) { index = 0; }
else {
Expand Down
6 changes: 1 addition & 5 deletions OpenSim/Common/ComponentSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,17 +318,13 @@ class OSIMCOMMON_API AbstractSocket {
private:

void setConnecteePathInternal(const std::string& name, int index) {
OPENSIM_THROW_IF(!isConnected(), Exception,
"Socket '{}' not connected.", getName());
using SimTK::isIndexInRange;
SimTK_INDEXCHECK(index, getNumConnectees(),
"AbstractSocket::setConnecteePath()");
updConnecteePathProp().setValue(index, name);
}

const std::string& getConnecteePathInternal(int index) const {
OPENSIM_THROW_IF(!isConnected(), Exception,
"Socket '{}' not connected.", getName());
using SimTK::isIndexInRange;
SimTK_INDEXCHECK(index, getNumConnectees(),
"AbstractSocket::getConnecteePath()");
Expand Down Expand Up @@ -404,7 +400,7 @@ class Socket : public AbstractSocket {
}

/** Return a const reference to the object connected to this Socket. */
const T& getConnectee(int index) const;
const T& getConnectee(int index = -1) const;

bool canConnectTo(const Object& object) const override {
return dynamic_cast<const T*>(&object) != nullptr;
Expand Down

0 comments on commit e87c971

Please sign in to comment.