本文整理汇总了C++中EXCEPTION0函数的典型用法代码示例。如果您正苦于以下问题:C++ EXCEPTION0函数的具体用法?C++ EXCEPTION0怎么用?C++ EXCEPTION0使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了EXCEPTION0函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EXCEPTION0
void
avtLineScanQuery::WalkChain1(vtkPolyData *pd, int ptId, int cellId,
vtkIntArray *lineids, int lineid,
int &newPtId, int &newCellId)
{
static vtkIdList *list = vtkIdList::New();
list->Reset();
pd->GetCellPoints(cellId, list);
if (list->GetNumberOfIds() != 2)
{
EXCEPTION0(ImproperUseException);
}
int id1 = list->GetId(0);
int id2 = list->GetId(1);
newPtId = (id1 == ptId ? id2 : id1);
int seg1, seg2;
int numMatches = GetCellsForPoint(newPtId, pd, lineids, lineid, seg1, seg2);
if (numMatches <= 1)
newCellId = -1;
else if (numMatches > 2)
{
EXCEPTION0(ImproperUseException);
}
else
{
newCellId = (seg1 == cellId ? seg2 : seg1);
}
}
示例2: EXCEPTION0
void
avtOpacityMap::SetTable(RGBA *arr, int te, double attenuation)
{
if (attenuation < 0. || attenuation > 1.)
{
debug1 << "Bad attenuation value " << attenuation << std::endl;
EXCEPTION0(ImproperUseException);
}
if (table != NULL)
{
delete [] table;
}
tableEntries = te;
table = new RGBA[tableEntries];
for (int i = 0 ; i < tableEntries ; i++)
{
table[i].R = arr[i].R;
table[i].G = arr[i].G;
table[i].B = arr[i].B;
table[i].A = arr[i].A * attenuation;
if (table[i].A < 0. || table[i].A > 1.)
{
debug1 << "Bad value " << table[i].A << std::endl;
EXCEPTION0(ImproperUseException);
}
}
//
// We need to set the intermediate vars again since the table size has
// potentially changed.
//
SetIntermediateVars();
}
示例3: if
avtDataTree_p
avtCurveCMFEExpression::ExecuteTree(avtDataTree_p tree1, avtDataTree_p tree2,
const std::string &invar,
const std::string &outvar)
{
if (tree1->GetNumberOfLeaves() == 0)
return tree1;
else if (tree1->GetNumberOfLeaves() != 1)
EXCEPTION0(ImproperUseException);
if (tree2->GetNumberOfLeaves() == 0)
return tree1;
else if (tree2->GetNumberOfLeaves() != 1)
EXCEPTION0(ImproperUseException);
//
// We know that there is only one leaf node. It is the curve.
//
vtkRectilinearGrid *curve1 =
vtkRectilinearGrid::SafeDownCast(tree1->GetSingleLeaf());
if (curve1 == NULL)
EXCEPTION0(ImproperUseException);
vtkRectilinearGrid *curve2 =
vtkRectilinearGrid::SafeDownCast(tree2->GetSingleLeaf());
if (curve2 == NULL)
EXCEPTION0(ImproperUseException);
vtkRectilinearGrid *rg =
MergeCurvesToSameXIntervals(curve1, curve2, outvar);
avtDataTree_p output = new avtDataTree(rg, 1);
rg->Delete();
return output;
}
示例4: EXCEPTION0
avtDataObject_p
avtDataObjectReader::GetOutput(void)
{
if (!haveInput)
{
EXCEPTION0(NoInputException);
}
if (InputIsDataset()) return datasetReader->GetOutput();
else if (InputIsImage()) return imageReader->GetOutput();
else if (InputIsNullData()) return nullDataReader->GetOutput();
else EXCEPTION0(NoInputException);
}
示例5: Accept
// ****************************************************************************
// Method: SocketBridge::StartNewBridge
//
// Purpose:
// Start a new bridge by accepting a new incoming connection and making
// a new outbound connection. This assumes there is already an incoming
// connection attempt pending.
//
// Programmer: Jeremy Meredith
// Creation: May 24, 2007
//
// Modifications:
// Gunther H. Weber, Thu Jan 14 11:38:27 PST 2010
// Added ability to connect bridge to other host than localhost.
//
// ****************************************************************************
void
SocketBridge::StartNewBridge()
{
int ofd = Accept(listen_fd, listen_sock);
if (ofd == -1)
EXCEPTION0(CouldNotConnectException);
originating_fd[num_bridges] = ofd;
int tfd = Connect(to_host, to_port);
if (tfd == -1)
EXCEPTION0(CouldNotConnectException);
terminating_fd[num_bridges] = tfd;
num_bridges++;
}
示例6: EXCEPTION0
void
avtExtents::CopyTo(double *exts)
{
if (exts == NULL)
{
//
// How can we copy into a NULL array?
//
EXCEPTION0(ImproperUseException);
}
if (extents == NULL)
{
//
// We don't have extents, so copy in the biggest bounds possible.
//
for (int i = 0 ; i < dimension ; i++)
{
exts[2*i] = +DBL_MAX;
exts[2*i+1] = -DBL_MAX;
}
}
else
{
//
// The most common case -- copy our extents over.
//
for (int i = 0 ; i < 2*dimension ; i++)
{
exts[i] = extents[i];
}
}
}
示例7: GetFileList
const GetFileListRPC::FileList *
GetFileListRPC::operator()(const std::string &f, bool grouping,
bool smartGrouping)
{
debug3 << "Executing GetFileList(" << f.c_str()
<< (grouping?"true":"false") << ", "
<< (smartGrouping?"true":"false") << ", "
<< ") RPC\n";
// Store the arguments.
filter = f;
automaticFileGrouping = grouping;
smartFileGrouping = smartGrouping;
// Try to execute the RPC.
Execute();
// If the RPC returned an error, throw an exception.
if(GetReply()->GetStatus() == error)
{
EXCEPTION0(GetFileListException);
}
return &fileList;
}
示例8: EXCEPTION0
void
avtOpacityMap::SetTable(unsigned char *arr, int te, double attenuation)
{
if (attenuation < 0. || attenuation > 1.)
{
debug1 << "Bad attenuation value " << attenuation << endl;
EXCEPTION0(ImproperUseException);
}
if (table != NULL)
{
delete [] table;
}
tableEntries = te;
table = new RGBA[tableEntries];
for (int i = 0 ; i < tableEntries ; i++)
{
table[i].R = arr[i*4];
table[i].G = arr[i*4+1];
table[i].B = arr[i*4+2];
table[i].A = ((float) arr[i*4+3] / 255.) * attenuation;
}
//
// We need to set the intermediate vars again since the table size has
// potentially changed.
//
SetIntermediateVars();
}
示例9: EXCEPTION0
void
avtVMetricVolume::MetricForWholeMesh(vtkDataSet *ds, vtkDataArray *rv)
{
if (ds->GetDataObjectType() != VTK_RECTILINEAR_GRID)
EXCEPTION0(ImproperUseException);
vtkRectilinearGrid *rg = (vtkRectilinearGrid *) ds;
vtkDataArray *X = rg->GetXCoordinates();
vtkDataArray *Y = rg->GetYCoordinates();
vtkDataArray *Z = rg->GetZCoordinates();
int dims[3];
rg->GetDimensions(dims);
double *Xdist = new double[dims[0]-1];
for (int i = 0 ; i < dims[0]-1 ; i++)
Xdist[i] = X->GetTuple1(i+1) - X->GetTuple1(i);
double *Ydist = new double[dims[1]-1];
for (int i = 0 ; i < dims[1]-1 ; i++)
Ydist[i] = Y->GetTuple1(i+1) - Y->GetTuple1(i);
double *Zdist = new double[dims[2]-1];
for (int i = 0 ; i < dims[2]-1 ; i++)
Zdist[i] = Z->GetTuple1(i+1) - Z->GetTuple1(i);
for (int k = 0 ; k < dims[2]-1 ; k++)
for (int j = 0 ; j < dims[1]-1 ; j++)
for (int i = 0 ; i < dims[0]-1 ; i++)
{
int idx = k*(dims[1]-1)*(dims[0]-1) + j*(dims[0]-1) + i;
double vol = Xdist[i]*Ydist[j]*Zdist[k];
rv->SetTuple1(idx, vol);
}
delete [] Xdist;
delete [] Ydist;
delete [] Zdist;
}
示例10: EXCEPTION0
void
avtGeometryDrawable::Remove(vtkRenderer *ren)
{
if (ren != renderer)
{
EXCEPTION0(ImproperUseException);
}
for (int i = 0 ; i < nActors ; i++)
{
if (actors[i] != NULL)
{
//
// This is supposed to approximate the RemoveActor call of
// vtkRenderer. That call also tells the actor to release its
// graphics resources, which does not work well for us, since
// we remove the actors every time we add new plots (the viewer
// does a ClearPlots) and also when the vis window re-orders the
// actors.
//
// THIS IS A MAINTENANCE ISSUE. This routine should be the same
// as vtkRenderer::RemoveActor, but does not call
// ReleaseGraphicsResources (which is actually called indirectly
// through vtkViewport::RemoveProp).
//
//ren->RemoveActor(actors[i]);
//
ren->GetActors()->RemoveItem(actors[i]);
actors[i]->RemoveConsumer(ren);
ren->GetViewProps()->RemoveItem(actors[i]);
}
}
renderer = NULL;
}
示例11: EXCEPTION0
unsigned char *
avtImageRepresentation::GetImageString(int &length, bool compress)
{
if (asChar == NULL)
{
if (asVTK == NULL)
{
EXCEPTION0(NoInputException);
}
CreateStringFromInput(asVTK, zbuffer, asChar, asCharLength);
asCharRef = new int(1);
}
if (compress)
{
int asCharLengthNew = 0;
unsigned char *asCharNew = 0;
if (CCompressDataString(asChar, asCharLength,
&asCharNew, &asCharLengthNew,
&timeToCompress, &compressionRatio))
{
delete [] asChar;
asChar = asCharNew;
asCharLength = asCharLengthNew;
}
}
length = asCharLength;
return asChar;
}
示例12: while
void
EngineMethods::GetProcInfo(ProcessAttributes &retAtts)
{
state->procInfoRPC();
// Get the reply and update the progress bar
while (state->procInfoRPC.GetStatus() == VisItRPC::incomplete ||
state->procInfoRPC.GetStatus() == VisItRPC::warning)
{
state->procInfoRPC.RecvReply();
}
// Check for abort
if (state->procInfoRPC.GetStatus() == VisItRPC::abort)
{
ClearStatus();
EXCEPTION0(AbortException);
}
// Check for an error
if (state->procInfoRPC.GetStatus() == VisItRPC::error)
{
RECONSTITUTE_EXCEPTION(state->procInfoRPC.GetExceptionType(),
state->procInfoRPC.Message());
}
retAtts = state->procInfoRPC.GetReturnAtts();
}
示例13: EXCEPTION0
void
avtHexahedron20Extractor::QuadraticHexExtract(const avtHexahedron20 &hex)
{
cerr << "avtHexahedron20Extractor::QuadraticHexExtract not implemented yet"
<< endl;
EXCEPTION0(ImproperUseException);
}
示例14: FindIndex
void
DBOptionsAttributes::SetEnumStrings(const std::string &name,
const std::vector<std::string> &values)
{
int eIndex = FindIndex(name);
if (eIndex < 0)
EXCEPTION0(BadDeclareFormatString);
int numEnums = (int)optEnums.size();
std::vector<std::string> newList;
int idx = 0;
for (int i = 0 ; i < numEnums ; i++)
{
if (i == eIndex)
{
for (size_t j = 0 ; j < values.size() ; j++)
newList.push_back(values[j]);
}
else
{
for (int j = 0 ; j < enumStringsSizes[i] ; j++)
newList.push_back(enumStrings[idx+j]);
}
idx += enumStringsSizes[i];
}
enumStrings = newList;
enumStringsSizes[eIndex] = values.size();
}
示例15: while
int
avtLineScanQuery::WalkChain(vtkPolyData *pd, int ptId, int cellId,
std::vector<bool> &usedPoint,
vtkIntArray *lineids, int lineid)
{
static vtkIdList *list = vtkIdList::New();
bool haventFoundEnd = true;
int curCell = cellId;
int curPt = ptId;
int endOfChain = -1;
int counter = 0;
while (haventFoundEnd)
{
list->Reset();
pd->GetCellPoints(curCell, list);
if (list->GetNumberOfIds() != 2)
{
EXCEPTION0(ImproperUseException);
}
int id1 = list->GetId(0);
int id2 = list->GetId(1);
int newId = (id1 == curPt ? id2 : id1);
usedPoint[newId] = true;
int seg1, seg2;
int numMatches =
GetCellsForPoint(newId, pd, lineids, lineid, seg1, seg2);
if (numMatches <= 1)
{
haventFoundEnd = false;
endOfChain = newId;
}
else if (numMatches > 2)
{
// This is an error condition. It is believed to occur when
// a line coincides with an edge. Empirically, it is believed
// to happen about one time when you cast 100K lines over 90M
// zones. So: it doesn't happen often, but it happens enough.
// In this case, just ignoring the line won't affect statistics.
haventFoundEnd = false;
endOfChain = -1;
}
else
{
curPt = newId;
curCell = (seg1 == curCell ? seg2 : seg1);
}
if (counter++ > 1000000)
{
haventFoundEnd = false;
endOfChain = -1;
}
}
return endOfChain;
}