Q_INVOKABLE void NObjBoardSettings::SetDefaultParams( int hwType, int hwNum, QString mac ) { AssertUnlocked(); m_defaultParams.reset( new BfBootCore::DefaultParam(hwType, hwNum, mac.toStdString()) ); }
template<typename Q> inline void View_( Q& A, const Q& B, bool lock ) { PushCallStack("View"); AssertDataTypes( A, B ); if ( !lock ) AssertUnlocked( B ); View__( A, B, lock ); PopCallStack(); }
/** * This method specifies that the given {@link Subsystem} is used by this command. * This method is crucial to the functioning of the Command System in general. * * <p>Note that the recommended way to call this method is in the constructor.</p> * * @param subsystem the {@link Subsystem} required * @see Subsystem */ void Command::Requires(Subsystem *subsystem) { if (!AssertUnlocked("Can not add new requirement to command")) return; if (subsystem != NULL) m_requirements.insert(subsystem); else wpi_setWPIErrorWithContext(NullParameter, "subsystem"); }
template<typename Q> inline void View2x1_( Q& A, const Q& BT, const Q& BB, bool lock ) { PushCallStack("View2x1"); AssertDataTypes( 3, &A, &BT, &BB ); if ( !lock ) AssertUnlocked( 2, &BT, &BB ); AssertContiguous2x1( BT, BB ); View2x1__( A, BT, BB, lock ); PopCallStack(); }
template<typename Q> inline void View1x2_( Q& A, const Q& BL, const Q& BR, bool lock ) { PushCallStack("View1x2"); AssertDataTypes( 3, &A, &BL, &BR ); if ( !lock ) AssertUnlocked( 2, &BL, &BR ); AssertContiguous1x2( BL, BR ); View1x2__( A, BL, BR, lock ); PopCallStack(); }
template<typename Q,typename Int> inline void View_( Q& A, const Q& B, Int i, Int j, Int height, Int width, bool lock ) { PushCallStack("View(i,j,h,w)"); AssertDataTypes( A, B ); if ( !lock ) AssertUnlocked( B ); AssertValidSubmatrix( i, j, height, width, B.Height(), B.Width() ); View__( A, B, i, j, height, width, lock ); PopCallStack(); }
template<typename Q> inline void View2x2_( Q& A, const Q& BTL, const Q& BTR, const Q& BBL, const Q& BBR, bool lock ) { PushCallStack( "View2x2" ); AssertDataTypes( 5, &A, &BTL, &BTR, &BBL, &BBR ); if ( !lock ) AssertUnlocked( 4, &BTL, &BTR, &BBL, &BBR ); AssertContiguous2x2( BTL, BTR, BBL, BBR ); View2x2__( A, BTL, BTR, BBL, BBR, lock ); PopCallStack(); }
inline void RepartitionDownDiagonal_ ( const Q& ATL, const Q& ATR, Q& A00, Q& A01, Q& A02, Q& A10, Q& A11, Q& A12, const Q& ABL, const Q& ABR, Q& A20, Q& A21, Q& A22, Int bsize, bool lock ) { PushCallStack("RepartitionDownDiagonal"); AssertDataTypes( 13, &ATL, &ATR, &A00, &A01, &A02, &A10, &A11, &A12, &ABL, &ABR, &A20, &A21, &A22 ); if ( !lock ) AssertUnlocked( 4, &ATL, &ATR, &ABL, &ABR ); AssertContiguous2x2( ATL, ATR, ABL, ABR ); RepartitionDownDiagonal__( ATL, ATR, A00, A01, A02, A10, A11, A12, ABL, ABR, A20, A21, A22, bsize, lock ); PopCallStack(); }
inline void RepartitionRight_ ( const Q& AL, const Q& AR, Q& A0, Q& A1, Q& A2, Int A1Width, bool lock ) { PushCallStack("RepartitionRight"); AssertNonnegative( A1Width, "width of A1 block" ); AssertDataTypes( 5, &AL, &AR, &A0, &A1, &A2 ); if ( !lock ) AssertUnlocked( 2, &AL, &AR ); AssertContiguous1x2( AL, AR ); RepartitionRight__( AL, AR, A0, A1, A2, A1Width, lock ); PopCallStack(); }
inline void RepartitionDown_ ( const Q& AT, Q& A0, Q& A1, const Q& AB, Q& A2, Int A1Height, bool lock ) { PushCallStack("RepartitionDown"); AssertNonnegative( A1Height, "height of A1 block" ); AssertDataTypes( 5, &AT, &AB, &A0, &A1, &A2 ); if ( !lock ) AssertUnlocked( 2, &AT, &AB ); AssertContiguous2x1( AT, AB ); RepartitionDown__( AT, A0, A1, AB, A2, A1Height, lock ); PopCallStack(); }
Q_INVOKABLE void NObjBoardSettings::SetNetwork( bool use, QString ip, QString gateway, QString mask ) { AssertUnlocked(); if (use) { m_userParams.Network = E1App::BoardAddresSettings(); return; } m_userParams.Network = E1App::BoardAddresSettings(ip.toStdString(), gateway.toStdString(), mask.toStdString()); if (!m_userParams.Network.get().IsValid()) ThrowRuntimeException("Invalid network settings"); }
/** * Adds a new {@link Command Command} to the group. The {@link Command Command} * will be started after all the previously added {@link Command Commands}. * * <p>Note that any requirements the given {@link Command Command} has will be * added to the group. For this reason, a {@link Command Command's} * requirements can not be changed after being added to a group.</p> * * <p>It is recommended that this method be called in the constructor.</p> * * @param command The {@link Command Command} to be added */ void CommandGroup::AddSequential(Command* command) { if (command == nullptr) { wpi_setWPIErrorWithContext(NullParameter, "command"); return; } if (!AssertUnlocked("Cannot add new command to command group")) return; command->SetParent(this); m_commands.push_back( CommandGroupEntry(command, CommandGroupEntry::kSequence_InSequence)); // Iterate through command->GetRequirements() and call Requires() on each // required subsystem Command::SubsystemSet requirements = command->GetRequirements(); auto iter = requirements.begin(); for (; iter != requirements.end(); iter++) Requires(*iter); }
/** * Adds a new child {@link Command} to the group with the given timeout. The * {@link Command} will be started after all the previously added * {@link Command Commands}. * * <p>Once the {@link Command Command} is started, it will run until it * finishes, is interrupted, or the time expires, whichever is sooner. Note * that the given {@link Command Command} will have no knowledge that it is on * a timer.</p> * * <p>Instead of waiting for the child to finish, a {@link CommandGroup} will * have it run at the same time as the subsequent {@link Command Commands}. * The child will run until either it finishes, the timeout expires, a new * child with conflicting requirements is started, or the main sequence runs a * {@link Command} with conflicting requirements. In the latter two cases, the * child will be canceled even if it says it can't be interrupted.</p> * * <p>Note that any requirements the given {@link Command Command} has will be * added to the group. For this reason, a {@link Command Command's} * requirements can not be changed after being added to a group.</p> * * <p>It is recommended that this method be called in the constructor.</p> * * @param command The command to be added * @param timeout The timeout (in seconds) */ void CommandGroup::AddParallel(Command* command, double timeout) { if (command == nullptr) { wpi_setWPIErrorWithContext(NullParameter, "command"); return; } if (!AssertUnlocked("Cannot add new command to command group")) return; if (timeout < 0.0) { wpi_setWPIErrorWithContext(ParameterOutOfRange, "timeout < 0.0"); return; } command->SetParent(this); m_commands.push_back(CommandGroupEntry( command, CommandGroupEntry::kSequence_BranchChild, timeout)); // Iterate through command->GetRequirements() and call Requires() on each // required subsystem Command::SubsystemSet requirements = command->GetRequirements(); auto iter = requirements.begin(); for (; iter != requirements.end(); iter++) Requires(*iter); }
bool NObjCommonBfTaskProfile::OnPropertyWrite( NamedObject *pObject, QString propertyName, QString val ) { ESS_ASSERT(this == pObject); AssertUnlocked(); // special case if (propertyName == "TraceClient") { m_prof.reset(); } if (propertyName == "CbpPort") { if (val.toInt() <= 0) ThrowRuntimeException("CbpPort must be positive"); } if (propertyName == "BoardAddress" || propertyName == "CbpPort") { m_transport.reset(); } return true; }
Q_INVOKABLE void NObjBoardSettings::SetUdpLogAddr( QString val, int port ) { AssertUnlocked(); m_userParams.UdpLogHost = val.toStdString(); m_userParams.UdpLogPort = port; }