本文整理汇总了C++中Handle函数的典型用法代码示例。如果您正苦于以下问题:C++ Handle函数的具体用法?C++ Handle怎么用?C++ Handle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Handle函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: rm
void JMXStartRemoteDCmd::execute(DCmdSource source, TRAPS) {
ResourceMark rm(THREAD);
HandleMark hm(THREAD);
// Load and initialize the sun.management.Agent class
// invoke startRemoteManagementAgent(string) method to start
// the remote management server.
// throw java.lang.NoSuchMethodError if the method doesn't exist
Handle loader = Handle(THREAD, SystemDictionary::java_system_loader());
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::sun_management_Agent(), loader, Handle(), true, CHECK);
instanceKlassHandle ik (THREAD, k);
JavaValue result(T_VOID);
// Pass all command line arguments to java as key=value,...
// All checks are done on java side
int len = 0;
stringStream options;
char comma[2] = {0,0};
// Leave default values on Agent.class side and pass only
// agruments explicitly set by user. All arguments passed
// to jcmd override properties with the same name set by
// command line with -D or by managmenent.properties
// file.
#define PUT_OPTION(a) \
do { \
if ( (a).is_set() ){ \
if ( *((a).type()) == 'I' ) { \
options.print("%scom.sun.management.%s=" JLONG_FORMAT, comma, (a).name(), (jlong)((a).value())); \
} else { \
options.print("%scom.sun.management.%s=%s", comma, (a).name(), (char*)((a).value())); \
} \
comma[0] = ','; \
}\
} while(0);
PUT_OPTION(_config_file);
PUT_OPTION(_jmxremote_host);
PUT_OPTION(_jmxremote_port);
PUT_OPTION(_jmxremote_rmi_port);
PUT_OPTION(_jmxremote_ssl);
PUT_OPTION(_jmxremote_registry_ssl);
PUT_OPTION(_jmxremote_authenticate);
PUT_OPTION(_jmxremote_password_file);
PUT_OPTION(_jmxremote_access_file);
PUT_OPTION(_jmxremote_login_config);
PUT_OPTION(_jmxremote_ssl_enabled_cipher_suites);
PUT_OPTION(_jmxremote_ssl_enabled_protocols);
PUT_OPTION(_jmxremote_ssl_need_client_auth);
PUT_OPTION(_jmxremote_ssl_config_file);
PUT_OPTION(_jmxremote_autodiscovery);
PUT_OPTION(_jdp_port);
PUT_OPTION(_jdp_address);
PUT_OPTION(_jdp_source_addr);
PUT_OPTION(_jdp_ttl);
PUT_OPTION(_jdp_pause);
PUT_OPTION(_jdp_name);
#undef PUT_OPTION
Handle str = java_lang_String::create_from_str(options.as_string(), CHECK);
JavaCalls::call_static(&result, ik, vmSymbols::startRemoteAgent_name(), vmSymbols::string_void_signature(), str, CHECK);
}
开发者ID:campolake,项目名称:openjdk9,代码行数:67,代码来源:diagnosticCommand.cpp
示例2: Handle
void Movie::HandlePadAndCircleStatus(Service::HID::PadState& pad_state, s16& circle_pad_x,
s16& circle_pad_y) {
Handle(pad_state, circle_pad_x, circle_pad_y);
}
开发者ID:lioncash,项目名称:citra,代码行数:4,代码来源:movie.cpp
示例3: return
const Session::Handle Session::proxy ( ::HINTERNET object )
{
return (Handle(object, &::abandon));
}
开发者ID:AndreLouisCaron,项目名称:w32,代码行数:4,代码来源:Session.cpp
示例4: Message
myAISContext->NextCurrent())
myAISContext->SetDisplayMode(myAISContext->Current(), 0);
TCollection_AsciiString Message ("\
\n\
for (myAISContext->InitCurrent(); myAISContext->MoreCurrent (); \n\
myAISContext->NextCurrent ()) \n\
myAISContext->SetDisplayMode(myAISContext->Current(), 0); \n\
\n");
CString text(Message.ToCString());
(*myCResultDialog).SetTitle(CString("Wireframe"));
(*myCResultDialog).SetText(text);
}
void DlgAttributes::Set(Handle ( AIS_InteractiveContext ) & acontext, CResultDialog& aResultDialog)
{
myAISContext = acontext;
myCResultDialog=&aResultDialog;
}
void DlgAttributes::OnTransparency()
{
/*
for (myAISContext->InitCurrent(); myAISContext->MoreCurrent ();
myAISContext->NextCurrent ()) {
int ival = (int) ((double) myAISContext->Current()->Transparency()*10.) ;
double rval = ((double) ival)/10.;
CDialogTransparency Dlg(NULL, rval);
开发者ID:SimVascular,项目名称:OpenCASCADE,代码行数:31,代码来源:DlgAttributes.cpp
示例5: Selection
{
/* Set a tab to be active and activate associated window
(if one exists).*/
VINT nOldTab = m_nActiveTab;
/* Save cache of active tab.*/
m_nActiveTab = nIndex;
/* Make tab control same setting.*/
Selection(m_nActiveTab);
/* Show active tab window and set position.*/
SetActiveChildPosition();
/* Hide old window.*/
HWND hWndOld = (nOldTab != -1) ? Handle(nOldTab) : NULL;
if ( hWndOld && ::IsWindow(hWndOld) )
::ShowWindow(hWndOld, SW_HIDE);
}
return Selection();
}
/** Add a tab and associated window. It is valid to use a temporary or
non-initialized window here, as it can be set at a later time. Returns
the index of the tab associated with the window, or -1 on failure. If
nIndex is -1, the tab will be added to end of existing tabs.*/
VINT AddTab( VSTRING_CONST pszText,
VWindow const& window,
VINT nIndex = -1)
开发者ID:OCLC-Developer-Network,项目名称:MARCView-Convert,代码行数:31,代码来源:vtabwindow.hpp
示例6: Handle
* destructor
*/
//=============================================================================
GEOMImpl_ILocalOperations::~GEOMImpl_ILocalOperations()
{
//MESSAGE("GEOMImpl_ILocalOperations::~GEOMImpl_ILocalOperations");
}
//=============================================================================
/*!
* MakeFilletAll
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletAll
(Handle(GEOM_Object) theShape, const GEOM_Parameter& theR)
{
SetErrorCode(GEOM_KO);
#ifdef LOCAL_OPS_CREATE_NEW_OBJECT
//Add a new Fillet object
Handle(GEOM_Object) aFillet = GetEngine()->AddObject(GetDocID(), GEOM_FILLET);
#else
Handle(GEOM_Object) aFillet = theShape;
#endif
Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
if (aRefShape.IsNull()) return NULL;
//Add a new Fillet function
Handle(GEOM_Function) aFunction =
开发者ID:dbarbier,项目名称:pythonocc,代码行数:31,代码来源:GEOMImpl_ILocalOperations.cpp
示例7: Handle
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_Fillet1dDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
GEOMImpl_IFillet1d aCI (aFunction);
Handle(GEOM_Function) aRefShape = aCI.GetShape();
TopoDS_Shape aShape = aRefShape->GetValue();
if (aShape.IsNull())
return 0;
if (aShape.ShapeType() != TopAbs_WIRE)
Standard_ConstructionError::Raise("Wrong arguments: polyline as wire must be given");
TopoDS_Wire aWire = TopoDS::Wire(aShape);
double rad = aCI.GetR();
if ( rad < Precision::Confusion())
return 0;
// collect vertices for make fillet
TopTools_ListOfShape aVertexList;
TopTools_MapOfShape mapShape;
int aLen = aCI.GetLength();
if ( aLen > 0 ) {
for (int ind = 1; ind <= aLen; ind++) {
TopoDS_Shape aShapeVertex;
if (GEOMImpl_ILocalOperations::GetSubShape
(aWire, aCI.GetVertex(ind), aShapeVertex))
if (mapShape.Add(aShapeVertex))
aVertexList.Append( aShapeVertex );
}
} else { // get all vertices from wire
TopExp_Explorer anExp( aWire, TopAbs_VERTEX );
for ( ; anExp.More(); anExp.Next() ) {
if (mapShape.Add(anExp.Current()))
aVertexList.Append( anExp.Current() );
}
}
if (aVertexList.IsEmpty())
Standard_ConstructionError::Raise("Invalid input no vertices to make fillet");
//INFO: this algorithm implemented in assumption that user can select both
// vertices of some edges to make fillet. In this case we should remember
// already modified initial edges to take care in next fillet step
TopTools_DataMapOfShapeShape anEdgeToEdgeMap;
//iterates on vertices, and make fillet on each couple of edges
//collect result fillet edges in list
TopTools_ListOfShape aListOfNewEdge;
// remember relation between initial and modified map
TopTools_IndexedDataMapOfShapeListOfShape aMapVToEdges;
TopExp::MapShapesAndAncestors( aWire, TopAbs_VERTEX, TopAbs_EDGE, aMapVToEdges );
TopTools_ListIteratorOfListOfShape anIt( aVertexList );
for ( ; anIt.More(); anIt.Next() ) {
TopoDS_Vertex aV = TopoDS::Vertex( anIt.Value() );
if ( aV.IsNull() || !aMapVToEdges.Contains( aV ) )
continue;
const TopTools_ListOfShape& aVertexEdges = aMapVToEdges.FindFromKey( aV );
if ( aVertexEdges.Extent() != 2 )
continue; // no input data to make fillet
TopoDS_Edge anEdge1 = TopoDS::Edge( aVertexEdges.First() );
TopoDS_Edge anEdge2 = TopoDS::Edge( aVertexEdges.Last() );
// check if initial edges already modified in previous fillet operation
if ( anEdgeToEdgeMap.IsBound( anEdge1 ) ) anEdge1 = TopoDS::Edge(anEdgeToEdgeMap.Find( anEdge1 ));
if ( anEdgeToEdgeMap.IsBound( anEdge2 ) ) anEdge2 = TopoDS::Edge(anEdgeToEdgeMap.Find( anEdge2 ));
if ( anEdge1.IsNull() || anEdge2.IsNull() || anEdge1.IsSame( anEdge2 ) )
continue; //no input data to make fillet
// create plane on 2 edges
gp_Pln aPlane;
if ( !takePlane(anEdge1, anEdge2, aV, aPlane) )
continue; // seems edges does not belong to same plane or parallel (fillet can not be build)
GEOMImpl_Fillet1d aFilletAlgo(anEdge1, anEdge2, aPlane);
if ( !aFilletAlgo.Perform(rad) )
continue; // can not create fillet with given radius
// take fillet result in given vertex
TopoDS_Edge aModifE1, aModifE2;
TopoDS_Edge aNewE = aFilletAlgo.Result(BRep_Tool::Pnt(aV), aModifE1, aModifE2);
if (aNewE.IsNull())
continue; // no result found
// add new created edges and take modified edges
aListOfNewEdge.Append( aNewE );
// check if face edges modified,
// if yes, than map to original edges (from vertex-edges list), because edges can be modified before
if (aModifE1.IsNull() || !anEdge1.IsSame( aModifE1 ))
addEdgeRelation( anEdgeToEdgeMap, TopoDS::Edge(aVertexEdges.First()), aModifE1 );
if (aModifE2.IsNull() || !anEdge2.IsSame( aModifE2 ))
addEdgeRelation( anEdgeToEdgeMap, TopoDS::Edge(aVertexEdges.Last()), aModifE2 );
}
//.........这里部分代码省略.........
开发者ID:triggerfish1,项目名称:pythonocc,代码行数:101,代码来源:GEOMImpl_Fillet1dDriver.cpp
示例8: ik
instanceOop MemoryManager::get_memory_manager_instance(TRAPS) {
// Must do an acquire so as to force ordering of subsequent
// loads from anything _memory_mgr_obj points to or implies.
instanceOop mgr_obj = (instanceOop)OrderAccess::load_ptr_acquire(&_memory_mgr_obj);
if (mgr_obj == NULL) {
// It's ok for more than one thread to execute the code up to the locked region.
// Extra manager instances will just be gc'ed.
klassOop k = Management::sun_management_ManagementFactory_klass(CHECK_0);
instanceKlassHandle ik(THREAD, k);
Handle mgr_name = java_lang_String::create_from_str(name(), CHECK_0);
JavaValue result(T_OBJECT);
JavaCallArguments args;
args.push_oop(mgr_name); // Argument 1
Symbol* method_name = NULL;
Symbol* signature = NULL;
if (is_gc_memory_manager()) {
method_name = vmSymbols::createGarbageCollector_name();
signature = vmSymbols::createGarbageCollector_signature();
args.push_oop(Handle()); // Argument 2 (for future extension)
} else {
method_name = vmSymbols::createMemoryManager_name();
signature = vmSymbols::createMemoryManager_signature();
}
JavaCalls::call_static(&result,
ik,
method_name,
signature,
&args,
CHECK_0);
instanceOop m = (instanceOop) result.get_jobject();
instanceHandle mgr(THREAD, m);
{
// Get lock before setting _memory_mgr_obj
// since another thread may have created the instance
MutexLocker ml(Management_lock);
// Check if another thread has created the management object. We reload
// _memory_mgr_obj here because some other thread may have initialized
// it while we were executing the code before the lock.
//
// The lock has done an acquire, so the load can't float above it, but
// we need to do a load_acquire as above.
mgr_obj = (instanceOop)OrderAccess::load_ptr_acquire(&_memory_mgr_obj);
if (mgr_obj != NULL) {
return mgr_obj;
}
// Get the address of the object we created via call_special.
mgr_obj = mgr();
// Use store barrier to make sure the memory accesses associated
// with creating the management object are visible before publishing
// its address. The unlock will publish the store to _memory_mgr_obj
// because it does a release first.
OrderAccess::release_store_ptr(&_memory_mgr_obj, mgr_obj);
}
}
return mgr_obj;
}
开发者ID:641252154,项目名称:HotSpot-JVM-Linux-x86-Research,代码行数:66,代码来源:memoryManager.cpp
示例9: Handle
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_ConeDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
GEOMImpl_ICone aCI (aFunction);
Standard_Integer aType = aFunction->GetType();
gp_Pnt aP;
gp_Vec aV;
Standard_Real aR1 = aCI.GetR1();
Standard_Real aR2 = aCI.GetR2();
if (aType == CONE_R1_R2_H) {
aP = gp::Origin();
aV = gp::DZ();
} else if (aType == CONE_PNT_VEC_R1_R2_H) {
Handle(GEOM_Function) aRefPoint = aCI.GetPoint();
Handle(GEOM_Function) aRefVector = aCI.GetVector();
TopoDS_Shape aShapePnt = aRefPoint->GetValue();
TopoDS_Shape aShapeVec = aRefVector->GetValue();
if (aShapePnt.IsNull() || aShapeVec.IsNull()) {
Standard_NullObject::Raise
("Cone creation aborted: point or vector is not defined");
}
if (aShapePnt.ShapeType() != TopAbs_VERTEX ||
aShapeVec.ShapeType() != TopAbs_EDGE) {
Standard_TypeMismatch::Raise
("Cone creation aborted: point or vector shapes has wrong type");
}
aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt));
TopoDS_Edge anE = TopoDS::Edge(aShapeVec);
TopoDS_Vertex V1, V2;
TopExp::Vertices(anE, V1, V2, Standard_True);
if (V1.IsNull() || V2.IsNull()) {
Standard_NullObject::Raise
("Cylinder creation aborted: vector is not defined");
}
aV = gp_Vec(BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
} else {
return 0;
}
if (aCI.GetH() < 0.0) aV.Reverse();
gp_Ax2 anAxes (aP, aV);
double theAngle = aCI.GetAngle();
if (theAngle == 0.)
theAngle = PI*2.;
TopoDS_Shape aShape;
// Cone does not work if same radius
if (fabs(aR1 - aR2) <= Precision::Confusion()) {
BRepPrimAPI_MakeCylinder MC (anAxes, (aR1 + aR2)/2.0, Abs(aCI.GetH()), theAngle);
MC.Build();
if (!MC.IsDone()) {
StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters");
}
aShape = MC.Shape();
} else {
BRepPrimAPI_MakeCone MC (anAxes, aCI.GetR1(), aCI.GetR2(), Abs(aCI.GetH()), theAngle);
MC.Build();
if (!MC.IsDone()) {
StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters");
}
aShape = MC.Shape();
}
if (aShape.IsNull()) return 0;
log.SetTouched(Label());
aFunction->SetValue(aShape);
return 1;
}
开发者ID:hmeyer,项目名称:salome-geom,代码行数:85,代码来源:GEOMImpl_ConeDriver.cpp
示例10: Export
SALOME_WNT_EXPORT
int Export( const TopoDS_Shape& theShape,
const TCollection_AsciiString& theFileName,
const TCollection_AsciiString& theFormatName)
{
MESSAGE("Export OBJ into file " << theFileName.ToCString());
std::ofstream fout(theFileName.ToCString());
Standard_Real Umin, Umax, Vmin, Vmax, dUmax, dVmax;
TopExp_Explorer ExpFace;
StdPrs_ToolShadedShape SST;
//Triangulate
BRepMesh::Mesh(theShape, DEFAULT_DEVIATION);
Standard_Integer ShapeId = 1;
Standard_Integer baseV = 0;
Standard_Integer baseN = 0;
Standard_Integer baseT = 0;
for(ExpFace.Init(theShape, TopAbs_FACE); ExpFace.More(); ExpFace.Next()) {
TopoDS_Face myFace = TopoDS::Face(ExpFace.Current());
TopLoc_Location aLocation;
Handle(Poly_Triangulation) myT = BRep_Tool::Triangulation(myFace, aLocation);
if (!myT.IsNull()) {
Poly_Connect pc(myT);
//write vertex buffer
const TColgp_Array1OfPnt& Nodes = myT->Nodes();
for (int i = Nodes.Lower(); i <= Nodes.Upper(); i++) {
gp_Pnt p = Nodes(i).Transformed(aLocation.Transformation());
fout << "v " << p.X() << " " << p.Y() << " " << p.Z() << std::endl;
}
fout << std::endl;
//write normal buffer
TColgp_Array1OfDir myNormal(Nodes.Lower(), Nodes.Upper());
SST.Normal(myFace, pc, myNormal);
//myNormal.Length();
for (int i = myNormal.Lower(); i <= myNormal.Upper(); i++) {
gp_Dir d = myNormal(i).Transformed(aLocation.Transformation());
fout << "vn " << d.X() << " " << d.Y() << " " << d.Z() << std::endl;
}
fout << std::endl;
//write uvcoord buffer
BRepTools::UVBounds(myFace,Umin, Umax, Vmin, Vmax);
dUmax = (Umax - Umin);
dVmax = (Vmax - Vmin);
const TColgp_Array1OfPnt2d& UVNodes = myT->UVNodes();
for (int i = UVNodes.Lower(); i <= UVNodes.Upper(); i++) {
gp_Pnt2d d = UVNodes(i);
Standard_Real u = (-UOrigin+(URepeat*(d.X()-Umin))/dUmax)/ScaleU;
Standard_Real v = (-VOrigin+(VRepeat*(d.Y()-Vmin))/dVmax)/ScaleV;
fout << "vt " << u << " " << v << " 0" << std::endl;
}
fout << std::endl;
//write triangle buffer
if (Interface_Static::IVal("write.obj.groups"))
fout << "g face_" << ShapeId++ << std::endl;
Standard_Integer n1 , n2 , n3;
const Poly_Array1OfTriangle& triangles = myT->Triangles();
for (int nt = 1; nt <= myT->NbTriangles(); nt++) {
if (SST.Orientation(myFace) == TopAbs_REVERSED)
triangles(nt).Get(n1,n3,n2);
else
triangles(nt).Get(n1,n2,n3);
if (TriangleIsValid (Nodes(n1),Nodes(n2),Nodes(n3)) ) {
fout << "f " <<n1 + baseV<<"/"<<n1 + baseT<<"/"<<n1 + baseN<<" "
<<n2 + baseV<<"/"<<n2 + baseT<<"/"<<n2 + baseN<<" "
<<n3 + baseV<<"/"<<n3 + baseT<<"/"<<n3 + baseN<<" "
<<std::endl;
}
}
fout << std::endl;
baseV += Nodes.Length();
baseN += myNormal.Length();
baseT += UVNodes.Length();
}
}
fout << std::flush;
fout.close();
return 1;
}
开发者ID:hmeyer,项目名称:salome-geom,代码行数:99,代码来源:ExchangeOBJ_Export.cpp
示例11: NULL_CHECK
jvmtiError
JvmtiEnvBase::get_object_monitor_usage(JavaThread* calling_thread, jobject object, jvmtiMonitorUsage* info_ptr) {
HandleMark hm;
Handle hobj;
bool at_safepoint = SafepointSynchronize::is_at_safepoint();
// Check arguments
{
oop mirror = JNIHandles::resolve_external_guard(object);
NULL_CHECK(mirror, JVMTI_ERROR_INVALID_OBJECT);
NULL_CHECK(info_ptr, JVMTI_ERROR_NULL_POINTER);
hobj = Handle(mirror);
}
JavaThread *owning_thread = NULL;
ObjectMonitor *mon = NULL;
jvmtiMonitorUsage ret = {
NULL, 0, 0, NULL, 0, NULL
};
uint32_t debug_bits = 0;
// first derive the object's owner and entry_count (if any)
{
// Revoke any biases before querying the mark word
if (SafepointSynchronize::is_at_safepoint()) {
BiasedLocking::revoke_at_safepoint(hobj);
} else {
BiasedLocking::revoke_and_rebias(hobj, false, calling_thread);
}
address owner = NULL;
{
markOop mark = hobj()->mark();
if (!mark->has_monitor()) {
// this object has a lightweight monitor
if (mark->has_locker()) {
owner = (address)mark->locker(); // save the address of the Lock word
}
// implied else: no owner
} else {
// this object has a heavyweight monitor
mon = mark->monitor();
// The owner field of a heavyweight monitor may be NULL for no
// owner, a JavaThread * or it may still be the address of the
// Lock word in a JavaThread's stack. A monitor can be inflated
// by a non-owning JavaThread, but only the owning JavaThread
// can change the owner field from the Lock word to the
// JavaThread * and it may not have done that yet.
owner = (address)mon->owner();
}
}
if (owner != NULL) {
// This monitor is owned so we have to find the owning JavaThread.
// Since owning_thread_from_monitor_owner() grabs a lock, GC can
// move our object at this point. However, our owner value is safe
// since it is either the Lock word on a stack or a JavaThread *.
owning_thread = Threads::owning_thread_from_monitor_owner(owner, !at_safepoint);
assert(owning_thread != NULL, "sanity check");
if (owning_thread != NULL) { // robustness
// The monitor's owner either has to be the current thread, at safepoint
// or it has to be suspended. Any of these conditions will prevent both
// contending and waiting threads from modifying the state of
// the monitor.
if (!at_safepoint && !JvmtiEnv::is_thread_fully_suspended(owning_thread, true, &debug_bits)) {
return JVMTI_ERROR_THREAD_NOT_SUSPENDED;
}
HandleMark hm;
Handle th(owning_thread->threadObj());
ret.owner = (jthread)jni_reference(calling_thread, th);
}
// implied else: no owner
}
if (owning_thread != NULL) { // monitor is owned
if ((address)owning_thread == owner) {
// the owner field is the JavaThread *
assert(mon != NULL,
"must have heavyweight monitor with JavaThread * owner");
ret.entry_count = mon->recursions() + 1;
} else {
// The owner field is the Lock word on the JavaThread's stack
// so the recursions field is not valid. We have to count the
// number of recursive monitor entries the hard way. We pass
// a handle to survive any GCs along the way.
ResourceMark rm;
ret.entry_count = count_locked_objects(owning_thread, hobj);
}
}
// implied else: entry_count == 0
}
int nWant,nWait;
if (mon != NULL) {
// this object has a heavyweight monitor
//.........这里部分代码省略.........
开发者ID:AllenWeb,项目名称:jdk7u-hotspot,代码行数:101,代码来源:jvmtiEnvBase.cpp
示例12: switch
void CConsoleWindow::HandleMouseEvent(UINT aMessage, WPARAM aWParam, LPARAM aLParam)
{
if (!iNoSelection)
{
switch(aMessage)
{
case WM_LBUTTONDOWN:
{
SetCapture(Handle());
iView->StartSelection(GET_X_LPARAM(aLParam), GET_Y_LPARAM(aLParam));
break;
}
case WM_LBUTTONDBLCLK:
{
iView->SelectWord(GET_X_LPARAM(aLParam), GET_Y_LPARAM(aLParam));
break;
}
case WM_MOUSEMOVE:
{
RECT clientRect;
GetClientRect(Handle(), &clientRect);
POINT mousePos = { GET_X_LPARAM(aLParam), GET_Y_LPARAM(aLParam) };
if ((mousePos.x > clientRect.right) || (mousePos.x < clientRect.left))
{
SCROLLINFO scrollInfo;
scrollInfo.cbSize = sizeof(scrollInfo);
scrollInfo.fMask = SIF_POS;
GetScrollInfo(Handle(), SB_HORZ, &scrollInfo);
if (mousePos.x > clientRect.right)
{
scrollInfo.nPos += iView->CharWidth();
}
else
{
scrollInfo.nPos -= iView->CharWidth();
}
SetScrollInfo (Handle(), SB_HORZ, &scrollInfo, TRUE);
GetScrollInfo (Handle(), SB_HORZ, &scrollInfo);
iView->SetHorzScrollPosition(scrollInfo.nPos);
}
if ((mousePos.y < clientRect.top) || (mousePos.y > clientRect.bottom))
{
SCROLLINFO scrollInfo;
scrollInfo.cbSize = sizeof(scrollInfo);
scrollInfo.fMask = SIF_POS;
GetScrollInfo(Handle(), SB_VERT, &scrollInfo);
if (mousePos.y < clientRect.top)
{
scrollInfo.nPos -= iView->CharHeight();
}
else
{
scrollInfo.nPos += iView->CharHeight();
}
SetScrollInfo (Handle(), SB_VERT, &scrollInfo, TRUE);
GetScrollInfo (Handle(), SB_VERT, &scrollInfo);
iView->SetVertScrollPosition(scrollInfo.nPos);
}
iView->AdjustSelection(GET_X_LPARAM(aLParam), GET_Y_LPARAM(aLParam));
break;
}
case WM_LBUTTONUP:
{
ReleaseCapture();
iView->EndSelection(GET_X_LPARAM(aLParam), GET_Y_LPARAM(aLParam));
break;
}
default:
{
break;
}
}
}
}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:75,代码来源:ConsoleWindow.cpp
示例13: Handle
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_PlateDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
if(aFunction.IsNull()) return 0;
GEOMImpl_IPlate aPI (aFunction);
Standard_Integer aType = aFunction->GetType();
TopoDS_Shape aShape;
if (aType == PLATE_BY_SHAPES_LIST) {
int ind, aLen = aPI.GetLength();
if (aLen < 1)
return 0;
GeomPlate_BuildPlateSurface aPlate;
Handle(GeomPlate_Surface) myPlateSurf;
Handle(GEOM_Function) aRefInitialShape = aPI.GetInitialShape();
if (!aRefInitialShape.IsNull()) {
TopoDS_Shape anInitialShape = aRefInitialShape->GetValue();
if (!anInitialShape.IsNull() && anInitialShape.ShapeType() == TopAbs_FACE)
{
aPlate.LoadInitSurface(BRep_Tool::Surface(TopoDS::Face(anInitialShape)));
TopExp_Explorer exp (anInitialShape, TopAbs_EDGE); //in case we have an init surface we must pass all of it's edges as constrains
for (; exp.More(); exp.Next()) { //otherwise exception is risen from the plate driver
BRepAdaptor_Curve aCurve(TopoDS::Edge(exp.Current()));
Handle(BRepAdaptor_HCurve) aHCurve = new BRepAdaptor_HCurve(aCurve);
Handle(GeomPlate_CurveConstraint) aCrvConstr = new GeomPlate_CurveConstraint(aHCurve, DEFAULT_CONTINUITY);
aPlate.Add(aCrvConstr);
}
}
}
for (ind = 1; ind <= aLen; ind++) {
Handle(GEOM_Function) aRefShape = aPI.GetShape(ind);
TopoDS_Shape aShape = aRefShape->GetValue();
if (aShape.ShapeType() == TopAbs_VERTEX) { //case a simple point
gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
Handle(GeomPlate_PointConstraint) aPntConstr = new GeomPlate_PointConstraint(aP, DEFAULT_CONTINUITY);
aPlate.Add(aPntConstr);
}
else {
TopExp_Explorer exp (aShape, TopAbs_EDGE); //this case treats all cases where edges can be found
Standard_Boolean hasEdge = Standard_False;
for (; exp.More(); exp.Next()) {
BRepAdaptor_Curve aCurve(TopoDS::Edge(exp.Current()));
Handle(BRepAdaptor_HCurve) aHCurve = new BRepAdaptor_HCurve(aCurve);
Handle(GeomPlate_CurveConstraint) aCrvConstr = new GeomPlate_CurveConstraint(aHCurve, DEFAULT_CONTINUITY);
aPlate.Add(aCrvConstr);
hasEdge = Standard_True;
}
if (!hasEdge) { //this case treats a compound of points
exp.Init(aShape, TopAbs_VERTEX);
for (; exp.More(); exp.Next()) {
gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(exp.Current()));
Handle(GeomPlate_PointConstraint) aPntConstr = new GeomPlate_PointConstraint(aP, DEFAULT_CONTINUITY);
aPlate.Add(aPntConstr);
}
}
}
}
aPlate.Perform();
if (!aPlate.IsDone())
Standard_ConstructionError::Raise("Plate surface cannot be created using the specific shapes !");
else
myPlateSurf = aPlate.Surface();
GeomPlate_MakeApprox aMKS( myPlateSurf, Precision::Approximation(), DEFAULT_Nbmax, DEFAULT_dgmax, DEFAULT_dmax);
BRepBuilderAPI_MakeFace MK (aMKS.Surface());
MK.Build();
if (!MK.IsDone())
Standard_ConstructionError::Raise("Plate topology cannot be created !");
else {
aShape = MK.Shape();
BRepCheck_Analyzer ana (aShape, false);
if (!ana.IsValid()) {
Standard_CString anErrStr("Plate algorithm has produced an invalid shape result");
#ifdef THROW_ON_INVALID_SH
Standard_ConstructionError::Raise(anErrStr);
#else
MESSAGE(anErrStr);
//further processing can be performed here
//...
//in case of failure of automatic treatment
//mark the corresponding GEOM_Object as problematic
TDF_Label aLabel = aFunction->GetOwnerEntry();
if (!aLabel.IsRoot()) {
Handle(GEOM_Object) aMainObj = GEOM_Object::GetObject(aLabel);
if (!aMainObj.IsNull())
aMainObj->SetDirty(Standard_True);
}
#endif
}
//.........这里部分代码省略.........
开发者ID:hmeyer,项目名称:salome-geom,代码行数:101,代码来源:GEOMImpl_PlateDriver.cpp
示例14: WindowHandle
void GWindow::Pour()
{
bool SafeToLock = false;
if (Wnd->IsLocked())
{
// I'm already locked... this could be bad if it's not me
thread_id Thread = WindowHandle()->LockingThread();
if (Thread != -1)
{
if (Thread == find_thread(NULL))
{
// it's all ok, I'm locking me
SafeToLock = true;
}
else
{
// someone else is locking us
// ok who is locking me?
thread_info Info;
if (get_thread_info(Thread, &Info) == B_OK)
{
printf("Evil locking thread: %i (%s)\n", Thread, Info.name);
}
else
{
printf("Couldn't get evil thread info\n");
}
}
}
}
else
{
SafeToLock = true;
}
if (!SafeToLock)
{
printf("%s:%i - Not safe to lock for ::Pour.\n", __FILE__, __LINE__);
return;
}
bool Lock = Wnd->Lock();
Wnd->BeginViewTransaction();
GRect r(Handle()->Frame());
r.Offset(-r.x1, -r.y1);
GRegion Client(r);
GRegion Update;
if (Menu)
{
GRect Mp = Menu->GetPos();
Mp.x2 = 10000;
Client.Subtract(&Mp);
}
for (GViewI *w = Children.First(); w; w = Children.Next())
{
GRect OldPos = w->GetPos();
Update.Union(&OldPos);
if (w->Pour(Client))
{
if (!w->Visible())
{
w->Visible(true);
}
Client.Subtract(&w->GetPos());
Update.Subtract(&w->GetPos());
}
else
{
// non-pourable
}
}
Wnd->EndViewTransaction();
Wnd->Sync();
// Handle()->Invalidate();
if (Lock) Wnd->Unlock();
}
开发者ID:FEI17N,项目名称:Lgi,代码行数:84,代码来源:GWindow.cpp
示例15: ImportSTEP
STEPIMPORT_EXPORT
TopoDS_Shape ImportSTEP (const TCollection_AsciiString& theFileName,
const TCollection_AsciiString& /*theFormatName*/,
TCollection_AsciiString& theError,
const TDF_Label& theShapeLabel)
{
MESSAGE("Import STEP model from file " << theFileName.ToCString());
// Set "C" numeric locale to save numbers correctly
//Kernel_Utils::Localizer loc;
TopoDS_Shape aResShape;
//VRV: OCC 4.0 migration
STEPControl_Reader aReader;
//VSR: 16/09/09: Convert to METERS
Interface_Static::SetCVal("xstep.cascade.unit","M");
Interface_Static::SetIVal("read.step.ideas", 1);
Interface_Static::SetIVal("read.step.nonmanifold", 1);
//VRV: OCC 4.0 migration
TopoDS_Compound compound;
BRep_Builder B;
B.MakeCompound(compound);
try {
#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
#endif
IFSelect_ReturnStatus status = aReader.ReadFile(theFileName.ToCString());
if (status == IFSelect_RetDone) {
Standard_Boolean failsonly = Standard_False;
aReader.PrintCheckLoad(failsonly, IFSelect_ItemsByEntity);
/* Root transfers */
Standard_Integer nbr = aReader.NbRootsForTransfer();
aReader.PrintCheckTransfer(failsonly, IFSelect_ItemsByEntity);
for (Standard_Integer n = 1; n <= nbr; n++) {
Standard_Boolean ok = aReader.TransferRoot(n);
/* Collecting resulting entities */
Standard_Integer nbs = aReader.NbShapes();
if (!ok || nbs == 0)
{
// THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::ImportStep", SALOME::BAD_PARAM);
continue; // skip empty root
}
/* For a single entity */
else if (nbr == 1 && nbs == 1) {
aResShape = aReader.Shape(1);
// ATTENTION: this is a workaround for mantis issue 0020442 remark 0010776
// It should be removed after patching OCCT for bug OCC22436
// (fix for OCCT is expected in service pack next to OCCT6.3sp12)
if (aResShape.ShapeType() == TopAbs_COMPOUND) {
int nbSub1 = 0;
TopoDS_Shape currShape;
TopoDS_Iterator It (aResShape, Standard_True, Standard_True);
for (; It.More(); It.Next()) {
nbSub1++;
currShape = It.Value();
}
if (nbSub1 == 1)
aResShape = currShape;
}
// END workaround
break;
}
for (Standard_Integer i = 1; i <= nbs; i++) {
TopoDS_Shape aShape = aReader.Shape(i);
if (aShape.IsNull()) {
// THROW_SALOME_CORBA_EXCEPTION("Null shape in GEOM_Gen_i::ImportStep", SALOME::BAD_PARAM) ;
//return aResShape;
continue;
}
else {
B.Add(compound, aShape);
}
}
}
if (aResShape.IsNull())
aResShape = compound;
// BEGIN: Store names of sub-shapes from file
TopTools_IndexedMapOfShape anIndices;
TopExp::MapShapes(aResShape, anIndices);
Handle(Interface_InterfaceModel) Model = aReader.WS()->Model();
Handle(XSControl_TransferReader) TR = aReader.WS()->TransferReader();
if (!TR.IsNull()) {
Handle(Transfer_TransientProcess) TP = TR->TransientProcess();
Handle(Standard_Type) tPD = STANDARD_TYPE(StepBasic_ProductDefinition);
Handle(Standard_Type) tShape = STANDARD_TYPE(StepShape_TopologicalRepresentationItem);
Handle(Standard_Type) tGeom = STANDARD_TYPE(StepGeom_GeometricRepresentationItem);
Standard_Integer nb = Model->NbEntities();
for (Standard_Integer ie = 1; ie <= nb; ie++) {
Handle(Standard_Transient) enti = Model->Value(ie);
Handle(TCollection_HAsciiString) aName;
if ( enti->IsKind( tShape ) || enti->IsKind(tGeom))
{
aName = Handle(StepRepr_RepresentationItem)::DownCast(enti)->Name();
}
else if (enti->DynamicType() == tPD)
{
//.........这里部分代码省略.........
开发者ID:triggerfish1,项目名称:pythonocc,代码行数:101,代码来源:ExchangeSTEP_Import.cpp
示例16: GlueEdgesWithPCurves
//=======================================================================
//function : GlueEdgesWithPCurves
//purpose : Glues the pcurves of the sequence of edges
// and glues their 3d curves
//=======================================================================
static TopoDS_Edge GlueEdgesWithPCurves(const TopTools_SequenceOfShape& aChain,
const TopoDS_Vertex& FirstVertex,
const TopoDS_Vertex& LastVertex)
{
Standard_Integer i, j;
TopoDS_Edge FirstEdge = TopoDS::Edge(aChain(1));
//TColGeom2d_SequenceOfCurve PCurveSeq;
TColGeom_SequenceOfSurface SurfSeq;
//TopTools_SequenceOfShape LocSeq;
BRep_ListIteratorOfListOfCurveRepresentation itr( (Handle(BRep_TEdge)::DownCast(FirstEdge.TShape()))->Curves() );
for (; itr.More(); itr.Next())
{
Handle(BRep_CurveRepresentation) CurveRep = itr.Value();
if (CurveRep->IsCurveOnSurface())
{
//PCurveSeq.Append(CurveRep->PCurve());
SurfSeq.Append(CurveRep->Surface());
/*
TopoDS_Shape aLocShape;
aLocShape.Location(CurveRep->Location());
LocSeq.Append(aLocShape);
*/
}
}
Standard_Real fpar, lpar;
BRep_Tool::Range(FirstEdge, fpar, lpar);
TopoDS_Edge PrevEdge = FirstEdge;
TopoDS_Vertex CV;
Standard_Real MaxTol = 0.;
TopoDS_Edge ResEdge;
BRep_Builder BB;
Standard_Integer nb_curve = aChain.Length(); //number of curves
TColGeom_Array1OfBSplineCurve tab_c3d(0,nb_curve-1); //array of the curves
TColStd_Array1OfReal tabtolvertex(0,nb_curve-1); //(0,nb_curve-2); //array of the tolerances
TopoDS_Vertex PrevVertex = FirstVertex;
for (i = 1; i <= nb_curve; i++)
{
TopoDS_Edge anEdge = TopoDS::Edge(aChain(i));
TopoDS_Vertex VF, VL;
TopExp::Vertices(anEdge, VF, VL);
Standard_Boolean ToReverse = (!VF.IsSame(PrevVertex));
Standard_Real Tol1 = BRep_Tool::Tolerance(VF);
Standard_Real Tol2 = BRep_Tool::Tolerance(VL);
if (Tol1 > MaxTol)
MaxTol = Tol1;
if (Tol2 > MaxTol)
MaxTol = Tol2;
if (i > 1)
{
TopExp::CommonVertex(PrevEdge, anEdge, CV);
Standard_Real Tol = BRep_Tool::Tolerance(CV);
tabtolvertex(i-2) = Tol;
}
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, fpar, lpar);
Handle(Geom_TrimmedCurve) aTrCurve = new Geom_TrimmedCurve(aCurve, fpar, lpar);
tab_c3d(i-1) = GeomConvert::CurveToBSplineCurve(aTrCurve);
GeomConvert::C0BSplineToC1BSplineCurve(tab_c3d(i-1), Precision::Confusion());
if (ToReverse)
tab_c3d(i-1)->Reverse();
PrevVertex = (ToReverse)? VF : VL;
PrevEdge = anEdge;
}
Handle(TColGeom_HArray1OfBSplineCurve) concatcurve; //array of the concatenated curves
Handle(TColStd_HArray1OfInteger) ArrayOfIndices; //array of the remining Vertex
GeomConvert::ConcatC1(tab_c3d,
tabtolvertex,
ArrayOfIndices,
concatcurve,
Standard_False,
Precision::Confusion()); //C1 concatenation
if (concatcurve->Length() > 1)
{
GeomConvert_CompCurveToBSplineCurve Concat(concatcurve->Value(concatcurve->Lower()));
for (i = concatcurve->Lower()+1; i <= concatcurve->Upper(); i++)
Concat.Add( concatcurve->Value(i), MaxTol, Standard_True );
concatcurve->SetValue(concatcurve->Lower(), Concat.BSplineCurve());
}
Handle(Geom_BSplineCurve) ResCurve = concatcurve->Value(concatcurve->Lower());
TColGeom2d_SequenceOfBoundedCurve ResPCurves;
TopLoc_Location aLoc;
for (j = 1; j <= SurfSeq.Length(); j++)
{
//.........这里部分代码省略.........
开发者ID:triggerfish1,项目名称:pythonocc,代码行数:101,代码来源:BlockFix_UnionEdges.cpp
示例17: cb
void ReadWholeRequest::operator()(boost::system::error_code const& errc)
{
cb(Handle(this), errc);
}
开发者ID:daedric,项目名称:httpp,代码行数:4,代码来源:ReadWholeRequest.cpp
示例18: MergeEdges
//=======================================================================
//funct
|
请发表评论