本文整理汇总了C++中Assignment类的典型用法代码示例。如果您正苦于以下问题:C++ Assignment类的具体用法?C++ Assignment怎么用?C++ Assignment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Assignment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qDebug
void DomainServer::nodeKilled(Node* node) {
// if this node has linked data it was from an assignment
if (node->getLinkedData()) {
Assignment* nodeAssignment = (Assignment*) node->getLinkedData();
qDebug() << "Adding assignment" << *nodeAssignment << " back to queue.\n";
// find this assignment in the static file
for (int i = 0; i < MAX_STATIC_ASSIGNMENT_FILE_ASSIGNMENTS; i++) {
if (_staticAssignments[i].getUUID() == nodeAssignment->getUUID()) {
// reset the UUID on the static assignment
_staticAssignments[i].resetUUID();
// put this assignment back in the queue so it goes out
_assignmentQueueMutex.lock();
_assignmentQueue.push_back(&_staticAssignments[i]);
_assignmentQueueMutex.unlock();
} else if (_staticAssignments[i].getUUID().isNull()) {
// we are at the blank part of the static assignments - break out
break;
}
}
}
}
示例2: Assignment
void DomainServer::civetwebUploadHandler(struct mg_connection *connection, const char *path) {
// create an assignment for this saved script, for now make it local only
Assignment* scriptAssignment = new Assignment(Assignment::CreateCommand,
Assignment::AgentType,
NULL,
Assignment::LocalLocation);
// check how many instances of this assignment the user wants by checking the ASSIGNMENT-INSTANCES header
const char ASSIGNMENT_INSTANCES_HTTP_HEADER[] = "ASSIGNMENT-INSTANCES";
const char* requestInstancesHeader = mg_get_header(connection, ASSIGNMENT_INSTANCES_HTTP_HEADER);
if (requestInstancesHeader) {
// the user has requested a number of instances greater than 1
// so set that on the created assignment
scriptAssignment->setNumberOfInstances(atoi(requestInstancesHeader));
}
QString newPath(ASSIGNMENT_SCRIPT_HOST_LOCATION);
newPath += "/";
// append the UUID for this script as the new filename, remove the curly braces
newPath += uuidStringWithoutCurlyBraces(scriptAssignment->getUUID());
// rename the saved script to the GUID of the assignment and move it to the script host locaiton
rename(path, newPath.toLocal8Bit().constData());
qDebug("Saved a script for assignment at %s\n", newPath.toLocal8Bit().constData());
// add the script assigment to the assignment queue
// lock the assignment queue mutex since we're operating on a different thread than DS main
domainServerInstance->_assignmentQueueMutex.lock();
domainServerInstance->_assignmentQueue.push_back(scriptAssignment);
domainServerInstance->_assignmentQueueMutex.unlock();
}
示例3: assert
void StatementList::makeIsect(StatementList &a, LocationSet &b)
{
if (this == &a) { // *this = *this isect b
for (auto it = a.begin(); it != a.end();) {
assert((*it)->isAssignment());
Assignment *as = static_cast<Assignment *>(*it);
if (!b.contains(as->getLeft())) {
it = m_list.erase(it);
}
else {
it++;
}
}
}
else { // normal assignment
clear();
for (Statement *stmt : a) {
assert(stmt->isAssignment());
Assignment *as = static_cast<Assignment *>(stmt);
if (b.contains(as->getLeft())) {
append(as);
}
}
}
}
示例4: get_merged_assignment
Assignment get_merged_assignment(const Subset &s, const Assignment &ss0,
const Ints &i0, const Assignment &ss1,
const Ints &i1) {
Ints ret(s.size(), -1);
IMP_USAGE_CHECK(ss0.size() == i0.size(),
"The size of the subset and "
<< "the index don't match: " << ss0.size() << " vs "
<< i0.size());
IMP_USAGE_CHECK(ss1.size() == i1.size(),
"The size of the subset and "
<< "the index don't match: " << ss1.size() << " vs "
<< i1.size());
for (unsigned int i = 0; i < i0.size(); ++i) {
ret[i0[i]] = ss0[i];
}
for (unsigned int i = 0; i < i1.size(); ++i) {
ret[i1[i]] = ss1[i];
}
IMP_IF_CHECK(USAGE) {
for (unsigned int i = 0; i < ret.size(); ++i) {
IMP_USAGE_CHECK(ret[i] >= 0, "Not all set");
}
}
return Assignment(ret);
}
示例5: solution
/// Check whether \a x is solution
virtual bool solution(const Assignment& x) const {
for (int i=0; i<x.size(); i++)
for (int j=i+1; j<x.size(); j++)
if (x[i]+i==x[j]+j)
return false;
return true;
}
示例6: proba
//! What is the probability of this type assignment ?
float SPGParser::proba(Assignment a)
{
float prob = 1.0;
for(Assignment::iterator it = a.begin();
it != a.end(); it++)
prob *= proba(*it);
return prob;
}
示例7: IsSubAssignmentOf
bool Tuple::IsSubAssignmentOf(const Assignment &assignment) const {
for (std::size_t i = 0; i < this->size(); ++i) {
PVPair pvpair = (*this)[i];
if (!assignment.IsContainParam(pvpair.pid_) || assignment.GetValue(pvpair.pid_) != pvpair.vid_) {
return false;
}
}
return true;
}
示例8: main
int main(int argc, char *argv[])
{
// Uncomment this line to run the Rift/Connect/Physics demo as per
// http://www.youtube.com/watch?v=EEbVHxOkTxw
Assignment game;
game.Run();
return 0;
}
示例9: NonNullAssignment
/// searchForAssignment - Look for a cached solution for a query.
///
/// \param key - The query to look up.
/// \param result [out] - The cached result, if the lookup is succesful. This is
/// either a satisfying assignment (for a satisfiable query), or 0 (for an
/// unsatisfiable query).
/// \return - True if a cached result was found.
bool CexCachingSolver::searchForAssignment(KeyType &key, Assignment *&result) {
Assignment * const *lookup = cache.lookup(key);
if (lookup) {
result = *lookup;
return true;
}
if (CexCacheTryAll) {
// Look for a satisfying assignment for a superset, which is trivially an
// assignment for any subset.
Assignment **lookup = cache.findSuperset(key, NonNullAssignment());
// Otherwise, look for a subset which is unsatisfiable, see below.
if (!lookup)
lookup = cache.findSubset(key, NullAssignment());
// If either lookup succeeded, then we have a cached solution.
if (lookup) {
result = *lookup;
return true;
}
// Otherwise, iterate through the set of current assignments to see if one
// of them satisfies the query.
for (assignmentsTable_ty::iterator it = assignmentsTable.begin(),
ie = assignmentsTable.end(); it != ie; ++it) {
Assignment *a = *it;
if (a->satisfies(key.begin(), key.end())) {
result = a;
return true;
}
}
} else {
// FIXME: Which order? one is sure to be better.
// Look for a satisfying assignment for a superset, which is trivially an
// assignment for any subset.
Assignment **lookup = cache.findSuperset(key, NonNullAssignment());
// Otherwise, look for a subset which is unsatisfiable -- if the subset is
// unsatisfiable then no additional constraints can produce a valid
// assignment. While searching subsets, we also explicitly the solutions for
// satisfiable subsets to see if they solve the current query and return
// them if so. This is cheap and frequently succeeds.
if (!lookup)
lookup = cache.findSubset(key, NullOrSatisfyingAssignment(key));
// If either lookup succeeded, then we have a cached solution.
if (lookup) {
result = *lookup;
return true;
}
}
return false;
}
示例10: setAssignments
void XMLConverter::setAssignments(Assignments & assignments)
{
for (Assignments::iterator i = assignments.begin(), e = assignments.end();
i != e; i++)
{
Assignment * assignment = *i;
RequestOverseer * overseer = getOverseerByRequest(assignment->getRequest());
overseer->assign(assignment, *networkOverseer);
}
}
示例11: a
//! Create the union with another set
Assignment Assignment::createUnion(const Assignment &rhs) const
{
Assignment a(*this);
for(Assignment::iterator it = rhs.begin();
it != rhs.end(); it++)
a.insert(*it);
return a;
}
示例12: qPrintable
QDebug operator<<(QDebug debug, const Assignment &assignment) {
debug.nospace() << "UUID: " << qPrintable(assignment.getUUID().toString()) <<
", Type: " << assignment.getType();
if (!assignment.getPool().isEmpty()) {
debug << ", Pool: " << assignment.getPool();
}
return debug.space();
}
示例13: makeIsect
// Special intersection method: this := a intersect b
void StatementList::makeIsect(StatementList& a, LocationSet& b)
{
slist.clear();
for (iterator it = a.slist.begin(); it != a.slist.end(); ++it)
{
Assignment* as = (Assignment*)*it;
if (b.exists(as->getLeft()))
slist.push_back(as);
}
}
示例14: Visit
virtual void Visit(Assignment& instruction)
{
Prefix(instruction);
if (!instruction.First()->IsType(Expression::DUMMY))
{
instruction.First()->GenerateCode(mOut);
mOut << " = ";
}
instruction.Second()->GenerateCode(mOut);
mOut << ';' << std::endl;
}
示例15:
bool Why3Translator::visit(Assignment const& _node)
{
if (_node.assignmentOperator() != Token::Assign)
error(_node, "Compound assignment not supported.");
_node.leftHandSide().accept(*this);
add(m_currentLValueIsRef ? " := " : " <- ");
_node.rightHandSide().accept(*this);
return false;
}