本文整理汇总了C++中Information类的典型用法代码示例。如果您正苦于以下问题:C++ Information类的具体用法?C++ Information怎么用?C++ Information使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Information类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: memcpy
Token *ScannerImp::createToken(TType typ,int wortlaenge,int X_Anfang,int Y_Anfang){
x+=wortlaenge;
char tmp[wortlaenge + 1];
memcpy(tmp, tokenAnfang, (size_t) wortlaenge);
tmp[wortlaenge] = '\0';
Information <char*>* info;
switch(typ) {
case Identifier:
info = symboltable->insert(tmp, X_Anfang, Y_Anfang);
switch (info->getX()) {
case -1:
typ = If;
break;
case -2:
typ = While;
break;
default:break;
}
break;
case Integer:
return new Token(typ, X_Anfang, Y_Anfang, new InfoInt(tmp));
case Fehler:
buffer->getChar();
return new Token(typ, X_Anfang, Y_Anfang, new InfoError(tmp));
default:break;
}
return new Token(typ, X_Anfang, Y_Anfang, info);
}
示例2: PrintMessage
LfcCommand * ServState::NextState(
std::vector<Item *>::const_iterator & iterator,
vector<Item*> items,
Item* item
) {
PrintMessage("SERV", item);
item->SetAssigned(true);
int errorStart = item->GetInformation().find(':');
string info = item->GetInformation().substr(errorStart + 1);
Information * information = new Information();
information->SetInformation(info);
if (item->GetUser()->GetName().length() != 0 && item->GetUser()->GetName().find('=') == std::string::npos) {
item->GetStartTime()->print();
return NULL;
}
return new LfcServCommand(
item->GetStartTime(),
item->GetEndTime(),
item->GetFilePath(),
new User("UNKNOWN"),
item->GetSite(),
true,
information);
}
示例3: stresses
int
FourNodeQuad3d::getResponse(int responseID, Information &eleInfo)
{
if (responseID == 1) {
return eleInfo.setVector(this->getResistingForce());
} else if (responseID == 3) {
// Loop over the integration points
static Vector stresses(12);
int cnt = 0;
for (int i = 0; i < 4; i++) {
// Get material stress response
const Vector &sigma = theMaterial[i]->getStress();
stresses(cnt) = sigma(0);
stresses(cnt+1) = sigma(1);
stresses(cnt+2) = sigma(2);
cnt += 3;
}
return eleInfo.setVector(stresses);
} else
return -1;
}
示例4: switch
int
TFP_Bearing::getResponse(int responseID, Information &eleInfo)
{
double strain;
// Vector res(this->getResistingForce());
// res(2) = Ac;
switch (responseID) {
case -1:
return -1;
case 1: // global forces
return eleInfo.setVector(this->getResistingForce());
// return eleInfo.setVector(res);
case 2: // v
for (int i=0; i<8; i++)
vectorSize8(i)=vTrial[i];
return eleInfo.setVector(vectorSize8);
case 3: // vp
for (int i=0; i<8; i++)
vectorSize8(i)=vpTrial[i];
return eleInfo.setVector(vectorSize8);
default:
return 0;
}
}
示例5: switch
int
SectionForceDeformation2d::getResponse(int responseID, Information &secInfo)
{
switch (responseID) {
case 1:
return secInfo.setVector(this->getSectionDeformation());
case 2:
return secInfo.setVector(this->getStressResultant());
case 4: {
Vector &theVec = *(secInfo.theVector);
const Vector &e = this->getSectionDeformation();
const Vector &s = this->getStressResultant();
int order = this->getOrder();
for (int i = 0; i < order; i++) {
theVec(i) = e(i);
theVec(i+order) = s(i);
}
return secInfo.setVector(theVec);
}
default:
return -1;
}
}
示例6: stresses
int
NineNodeMixedQuad::getResponse(int responseID, Information &eleInfo)
{
if (responseID == 1) {
return eleInfo.setVector(this->getResistingForce());
} else if (responseID == 3) {
// Loop over the integration points
static Vector stresses(4*9);
int cnt = 0;
for (int i = 0; i < 9; i++) {
// Get material stress response
const Vector &sigma = materialPointers[i]->getStress();
stresses(cnt) = sigma(0);
stresses(cnt+1) = sigma(1);
stresses(cnt+2) = sigma(2);
stresses(cnt+3) = sigma(3);
cnt += 4;
}
return eleInfo.setVector(stresses);
} else
return -1;
}
示例7: data
int
FiberSection3d::getResponse(int responseID, Information §Info)
{
// Just call the base class method ... don't need to define
// this function, but keeping it here just for clarity
if (responseID == 5) {
int numData = 5*numFibers;
Vector data(numData);
int count = 0;
for (int j = 0; j < numFibers; j++) {
double yLoc, zLoc, A, stress, strain;
yLoc = matData[3*j];
zLoc = matData[3*j+1];
A = matData[3*j+2];
stress = theMaterials[j]->getStress();
strain = theMaterials[j]->getStrain();
data(count) = yLoc; data(count+1) = zLoc; data(count+2) = A;
data(count+3) = stress; data(count+4) = strain;
count += 5;
}
return sectInfo.setVector(data);
} else if (responseID == 6) {
int count = 0;
for (int j = 0; j < numFibers; j++) {
if (theMaterials[j]->hasFailed() == true)
count++;
}
return sectInfo.setInt(count);
}
return SectionForceDeformation::getResponse(responseID, sectInfo);
}
示例8: if
int
FourNodeQuadWithSensitivity::getResponse(int responseID, Information &eleInfo)
{
if (responseID == 1) {
return eleInfo.setVector(this->getResistingForce());
} else if (responseID == 2) {
return eleInfo.setMatrix(this->getTangentStiff());
} else if (responseID == 3) {
// Loop over the integration points
int cnt = 0;
for (int i = 0; i < 4; i++) {
// Get material stress response
const Vector &sigma = theMaterial[i]->getStress();
P(cnt) = sigma(0);
P(cnt+1) = sigma(1);
cnt += 2;
}
return eleInfo.setVector(P);
} else
return -1;
}
示例9: switch
int
Mehanny::getResponse(int responseID, Information &info)
{
switch (responseID) {
case -1:
return -1;
case 1:
return info.setDouble( this->getDamage() );
case 2:
return info.setDouble( TrialPlasticDefo );
case 3:
if(info.theVector!=0)
{
(*(info.theVector))(0) = TrialPosPHC;
(*(info.theVector))(1) = TrialSumPosFHC;
(*(info.theVector))(2) = TrialNegPHC;
(*(info.theVector))(3) = TrialSumNegFHC;
}
return 0;
default:
return -1;
}
}
示例10: slaveForce
int
BeamEndContact3D::getResponse(int responseID, Information &eleInfo)
{
// initialize variables
Vector slaveForce(3);
Vector masterForce(6);
if (responseID == 1) {
// forces on slave node
slaveForce(0) = -mInternalForces(6);
slaveForce(1) = -mInternalForces(7);
slaveForce(2) = -mInternalForces(8);
return eleInfo.setVector(slaveForce);
} else if (responseID == 2) {
// reactions (forces and moments) on master node
for (int i = 0; i < 3; i++) {
masterForce(i) = -mInternalForces(i);
masterForce(i+3) = -mInternalForces(i+3);
}
return eleInfo.setVector(masterForce);
} else {
// otherwise response quantity is unknown for the BeamEndContact3D class
opserr << "BeamEndContact3D::getResponse(int responseID = " << responseID << ", Information &eleInfo); "
<< " unknown request" << endln;
return -1;
}
}
示例11: getResponse
int YamamotoBiaxialHDR::getResponse(int responseID, Information &eleInfo)
{
switch (responseID) {
case 1: // global forces
return eleInfo.setVector(this->getResistingForce());
case 2: // local forces
theVector.Zero();
// determine resisting forces in local system
theVector = Tlb^basicForce;
return eleInfo.setVector(theVector);
case 3: // basic forces
return eleInfo.setVector(basicForce);
case 4: // local displacements
return eleInfo.setVector(localDisp);
case 5: // basic displacements
return eleInfo.setVector(basicDisp);
default:
return -1;
}
}
示例12: routeColor
void MissionPanel::Draw() const
{
MapPanel::Draw();
Color routeColor(.2, .1, 0., 0.);
const System *system = selectedSystem;
while(distance.Distance(system) > 0)
{
const System *next = distance.Route(system);
Point from = next->Position() + center;
Point to = system->Position() + center;
Point unit = (from - to).Unit() * 7.;
from -= unit;
to += unit;
LineShader::Draw(from, to, 5., routeColor);
system = next;
}
DrawSelectedSystem();
Point pos = DrawPanel(
Screen::TopLeft() + Point(0., -availableScroll),
"Missions available here:",
available.size());
DrawList(available, pos);
pos = DrawPanel(
Screen::TopRight() + Point(-SIDE_WIDTH, -acceptedScroll),
"Your current missions:",
AcceptedVisible());
DrawList(accepted, pos);
DrawMissionInfo();
const Set<Color> &colors = GameData::Colors();
const Color &availableColor = *colors.Get("available back");
const Color &unavailableColor = *colors.Get("unavailable back");
const Color ¤tColor = *colors.Get("active back");
const Color &blockedColor = *colors.Get("blocked back");
if(availableIt != available.end() && availableIt->Destination())
DotShader::Draw(availableIt->Destination()->GetSystem()->Position() + center,
22., 20.5, CanAccept() ? availableColor : unavailableColor);
if(acceptedIt != accepted.end() && acceptedIt->Destination())
{
bool isBlocked = !acceptedIt->Waypoints().empty();
for(const NPC &npc : acceptedIt->NPCs())
isBlocked |= !npc.HasSucceeded(player.GetSystem());
DotShader::Draw(acceptedIt->Destination()->GetSystem()->Position() + center,
22., 20.5, IsSatisfied(*acceptedIt) ? currentColor : blockedColor);
}
// Draw the buttons to switch to other map modes.
Information info;
info.SetCondition("is missions");
const Interface *interface = GameData::Interfaces().Get("map buttons");
interface->Draw(info);
}
示例13: data
int
FiberSection2d::getResponse(int responseID, Information §Info)
{
if (responseID == 5) {
int numData = 5*numFibers;
Vector data(numData);
int count = 0;
for (int j = 0; j < numFibers; j++) {
double yLoc, zLoc, A, stress, strain;
yLoc = matData[3*j];
zLoc = matData[3*j+1];
A = matData[3*j+2];
stress = theMaterials[j]->getStress();
strain = theMaterials[j]->getStrain();
data(count) = yLoc; data(count+1) = zLoc; data(count+2) = A;
data(count+3) = stress; data(count+4) = strain;
count += 5;
}
return sectInfo.setVector(data);
} else if (responseID == 6) {
int count = 0;
for (int j = 0; j < numFibers; j++) {
if (theMaterials[j]->hasFailed() == true)
count++;
}
return sectInfo.setInt(count);
}
return SectionForceDeformation::getResponse(responseID, sectInfo);
}
示例14: qb
int SingleFPSimple2d::getResponse(int responseID, Information &eleInfo)
{
double MpDelta1, MpDelta2;
switch (responseID) {
case 1: // global forces
return eleInfo.setVector(this->getResistingForce());
case 2: // local forces
theVector.Zero();
// determine resisting forces in local system
theVector = Tlb^qb;
// add P-Delta moments
MpDelta1 = qb(0)*(ul(4)-ul(1));
theVector(2) += MpDelta1;
MpDelta2 = qb(0)*(1.0 - shearDistI)*L*ul(5);
theVector(2) -= MpDelta2;
theVector(5) += MpDelta2;
return eleInfo.setVector(theVector);
case 3: // basic forces
return eleInfo.setVector(qb);
case 4: // local displacements
return eleInfo.setVector(ul);
case 5: // basic displacements
return eleInfo.setVector(ub);
default:
return -1;
}
}
示例15: DrawBackdrop
void InfoPanel::Draw() const
{
DrawBackdrop();
Information interfaceInfo;
if(showShip)
{
interfaceInfo.SetCondition("ship tab");
if(canEdit && (shipIt != player.Ships().end())
&& ((shipIt->get() != player.Flagship() && !(*shipIt)->IsDisabled()) || (*shipIt)->IsParked()))
interfaceInfo.SetCondition((*shipIt)->IsParked() ? "show unpark" : "show park");
else if(!canEdit)
interfaceInfo.SetCondition(CanDump() ? "enable dump" : "show dump");
if(player.Ships().size() > 1)
interfaceInfo.SetCondition("four buttons");
else
interfaceInfo.SetCondition("two buttons");
}
else
{
interfaceInfo.SetCondition("player tab");
if(canEdit && player.Ships().size() > 1)
{
bool allParked = true;
bool hasOtherShips = false;
const Ship *flagship = player.Flagship();
for(const auto &it : player.Ships())
if(!it->IsDisabled() && it.get() != flagship)
{
allParked &= it->IsParked();
hasOtherShips = true;
}
if(hasOtherShips)
interfaceInfo.SetCondition(allParked ? "show unpark all" : "show park all");
if(!allSelected.empty())
{
allParked = true;
for(int i : allSelected)
{
const Ship &ship = *player.Ships()[i];
if(!ship.IsDisabled() && &ship != flagship)
allParked &= ship.IsParked();
}
interfaceInfo.SetCondition(allParked ? "show unpark" : "show park");
}
}
interfaceInfo.SetCondition("two buttons");
}
const Interface *interface = GameData::Interfaces().Get("info panel");
interface->Draw(interfaceInfo);
zones.clear();
commodityZones.clear();
if(showShip)
DrawShip();
else
DrawInfo();
}