void VdkPanel::DoEraseBackground(wxDC &dc, const wxRect &rc) { if (!m_gbi) { dc.SetPen(*wxTRANSPARENT_PEN); dc.SetBrush(m_bgBrush); if (m_bi) { if (m_bi->borderPen.IsOk()) { dc.SetPen(m_bi->borderPen); } if (m_bi->bgColor.IsOk()) { wxBrush bgBrush(m_bi->bgColor); dc.SetBrush(bgBrush); } } dc.DrawRectangle(rc); } else { VdkDcClippingRegionDestroyer destroyer(dc, rc); m_Window->ResetDcOrigin(dc); TranslateDC(dc); dc.GradientFillLinear(m_Rect, m_gbi->beg, m_gbi->end, m_gbi->direction); } }
Array<CIMInstance> CIMClientRep::enumerateInstances( const CIMNamespaceName& nameSpace, const CIMName& className, Boolean deepInheritance, Boolean localOnly, Boolean includeQualifiers, Boolean includeClassOrigin, const CIMPropertyList& propertyList ) { AutoPtr<CIMRequestMessage> request(new CIMEnumerateInstancesRequestMessage( String::EMPTY, nameSpace, className, deepInheritance, localOnly, includeQualifiers, includeClassOrigin, propertyList, QueueIdStack())); Message* message = _doRequest(request, CIM_ENUMERATE_INSTANCES_RESPONSE_MESSAGE); CIMEnumerateInstancesResponseMessage* response = (CIMEnumerateInstancesResponseMessage*)message; AutoPtr<CIMEnumerateInstancesResponseMessage> destroyer(response); return(response->cimNamedInstances); }
virtual void startup() { thread_accepter_.start(new _ESQ accepter(setter_, dispatcher_, handler_), this); thread_transceiver_.start(new _ESQ transceiver(setter_, dispatcher_, handler_), this); thread_recycler_.start(new _ESQ recycler(setter_, dispatcher_, handler_), this); thread_destroyer_.start(new _ESQ destroyer(setter_, dispatcher_, handler_), this); processer_pools_.start(this); }
Array<CIMObject> CIMClientRep::references( const CIMNamespaceName& nameSpace, const CIMObjectPath& objectName, const CIMName& resultClass, const String& role, Boolean includeQualifiers, Boolean includeClassOrigin, const CIMPropertyList& propertyList ) { compareObjectPathtoCurrentConnection(objectName); AutoPtr<CIMRequestMessage> request(new CIMReferencesRequestMessage( String::EMPTY, nameSpace, objectName, resultClass, role, includeQualifiers, includeClassOrigin, propertyList, QueueIdStack())); Message* message = _doRequest(request, CIM_REFERENCES_RESPONSE_MESSAGE); CIMReferencesResponseMessage* response = (CIMReferencesResponseMessage*)message; AutoPtr<CIMReferencesResponseMessage> destroyer(response); return(response->cimObjects); }
Array<CIMName> CIMClientRep::enumerateClassNames( const CIMNamespaceName& nameSpace, const CIMName& className, Boolean deepInheritance ) { AutoPtr<CIMRequestMessage> request(new CIMEnumerateClassNamesRequestMessage( String::EMPTY, nameSpace, className, deepInheritance, QueueIdStack())); Message* message = _doRequest(request, CIM_ENUMERATE_CLASS_NAMES_RESPONSE_MESSAGE); CIMEnumerateClassNamesResponseMessage* response = (CIMEnumerateClassNamesResponseMessage*)message; AutoPtr<CIMEnumerateClassNamesResponseMessage> destroyer(response); // Temporary code until internal structures use CIMName instead of String Array<CIMName> classNameArray; classNameArray.reserveCapacity(response->classNames.size()); for (Uint32 i=0; i<response->classNames.size(); i++) { classNameArray.append(response->classNames[i]); } return(classNameArray); }
CIMInstance CIMClientRep::getInstance( const CIMNamespaceName& nameSpace, const CIMObjectPath& instanceName, Boolean localOnly, Boolean includeQualifiers, Boolean includeClassOrigin, const CIMPropertyList& propertyList ) { compareObjectPathtoCurrentConnection(instanceName); AutoPtr<CIMRequestMessage> request(new CIMGetInstanceRequestMessage( String::EMPTY, nameSpace, instanceName, localOnly, includeQualifiers, includeClassOrigin, propertyList, QueueIdStack())); Message* message = _doRequest(request, CIM_GET_INSTANCE_RESPONSE_MESSAGE); CIMGetInstanceResponseMessage* response = (CIMGetInstanceResponseMessage*)message; AutoPtr<CIMGetInstanceResponseMessage> destroyer(response); return(response->cimInstance); }
CIMClass CIMClientRep::getClass( const CIMNamespaceName& nameSpace, const CIMName& className, Boolean localOnly, Boolean includeQualifiers, Boolean includeClassOrigin, const CIMPropertyList& propertyList ) { AutoPtr<CIMRequestMessage> request(new CIMGetClassRequestMessage( String::EMPTY, nameSpace, className, localOnly, includeQualifiers, includeClassOrigin, propertyList, QueueIdStack())); Message* message = _doRequest(request, CIM_GET_CLASS_RESPONSE_MESSAGE); CIMGetClassResponseMessage* response = (CIMGetClassResponseMessage*)message; AutoPtr<CIMGetClassResponseMessage> destroyer(response); return(response->cimClass); }
Array<CIMObjectPath> CIMClientRep::referenceNames( const CIMNamespaceName& nameSpace, const CIMObjectPath& objectName, const CIMName& resultClass, const String& role ) { compareObjectPathtoCurrentConnection(objectName); AutoPtr<CIMRequestMessage> request(new CIMReferenceNamesRequestMessage( String::EMPTY, nameSpace, objectName, resultClass, role, QueueIdStack())); Message* message = _doRequest(request, CIM_REFERENCE_NAMES_RESPONSE_MESSAGE); CIMReferenceNamesResponseMessage* response = (CIMReferenceNamesResponseMessage*)message; AutoPtr<CIMReferenceNamesResponseMessage> destroyer(response); return(response->objectNames); }
/** * Destroy a module. * * @param _module Module instance pointer */ void destroy(T *_module) { if (_module) { init(); destroyer(_module); } }
static bool encodeImpl(const unsigned char* input, const IntSize& size, int bytesPerRow, Vector<unsigned char>* output, void (*conversionFunc)(const unsigned char*, int, unsigned char*) ) { int inputColorComponents = 4; int outputColorComponents = 4; int pngOutputColorType = PNG_COLOR_TYPE_RGB_ALPHA; IntSize imageSize(size); imageSize.clampNegativeToZero(); // Row stride should be at least as long as the length of the data. if (inputColorComponents * imageSize.width() > bytesPerRow) { ASSERT(false); return false; } png_struct* pngPtr = png_create_write_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); if (!pngPtr) return false; png_info* infoPtr = png_create_info_struct(pngPtr); if (!infoPtr) { png_destroy_write_struct(&pngPtr, NULL); return false; } PNGWriteStructDestroyer destroyer(&pngPtr, &infoPtr); if (setjmp(png_jmpbuf(pngPtr))) { // The destroyer will ensure that the structures are cleaned up in this // case, even though we may get here as a jump from random parts of the // PNG library called below. return false; } // Set our callback for libpng to give us the data. PNGEncoderState state(output); png_set_write_fn(pngPtr, &state, encoderWriteCallback, NULL); png_set_IHDR(pngPtr, infoPtr, imageSize.width(), imageSize.height(), 8, pngOutputColorType, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); png_write_info(pngPtr, infoPtr); OwnArrayPtr<unsigned char> rowPixels(new unsigned char[imageSize.width() * outputColorComponents]); for (int y = 0; y < imageSize.height(); y ++) { conversionFunc(&input[y * bytesPerRow], imageSize.width(), rowPixels.get()); png_write_row(pngPtr, rowPixels.get()); } png_write_end(pngPtr, infoPtr); return true; }
void conn_unregister(Connection *conn) { FDSet *set = NULL; int fd = -1; void *data = NULL; conn_callback_data_destroyer_t *destroyer = NULL; gw_assert(conn != NULL); if (conn == NULL || conn->fd < 0) return; /* We need both locks to update the registration information */ lock_out(conn); lock_in(conn); if (conn->registered) { set = conn->registered; fd = conn->fd; conn->registered = NULL; conn->callback = NULL; /* * remember and don't destroy data and data_destroyer because we * may be in callback right now. So destroy only after fdset_unregister * call which guarantee us we are not in callback anymore. */ data = conn->callback_data; conn->callback_data = NULL; destroyer = conn->callback_data_destroyer; conn->callback_data_destroyer = NULL; conn->listening_pollin = 0; conn->listening_pollout = 0; } unlock_in(conn); unlock_out(conn); /* now unregister from FDSet */ if (set != NULL) fdset_unregister(set, fd); /* ok we are not in callback anymore, destroy data if any */ if (data != NULL && destroyer != NULL) destroyer(data); }
void CIMClientRep::setQualifier( const CIMNamespaceName& nameSpace, const CIMQualifierDecl& qualifierDeclaration ) { AutoPtr<CIMRequestMessage> request(new CIMSetQualifierRequestMessage( String::EMPTY, nameSpace, qualifierDeclaration, QueueIdStack())); Message* message = _doRequest(request, CIM_SET_QUALIFIER_RESPONSE_MESSAGE); CIMSetQualifierResponseMessage* response = (CIMSetQualifierResponseMessage*)message; AutoPtr<CIMSetQualifierResponseMessage> destroyer(response); }
void CIMClientRep::deleteQualifier( const CIMNamespaceName& nameSpace, const CIMName& qualifierName ) { AutoPtr<CIMRequestMessage> request(new CIMDeleteQualifierRequestMessage( String::EMPTY, nameSpace, qualifierName, QueueIdStack())); Message* message = _doRequest(request, CIM_DELETE_QUALIFIER_RESPONSE_MESSAGE); CIMDeleteQualifierResponseMessage* response = (CIMDeleteQualifierResponseMessage*)message; AutoPtr<CIMDeleteQualifierResponseMessage> destroyer(response); }
Array<CIMQualifierDecl> CIMClientRep::enumerateQualifiers( const CIMNamespaceName& nameSpace ) { AutoPtr<CIMRequestMessage> request(new CIMEnumerateQualifiersRequestMessage( String::EMPTY, nameSpace, QueueIdStack())); Message* message = _doRequest(request, CIM_ENUMERATE_QUALIFIERS_RESPONSE_MESSAGE); CIMEnumerateQualifiersResponseMessage* response = (CIMEnumerateQualifiersResponseMessage*)message; AutoPtr<CIMEnumerateQualifiersResponseMessage> destroyer(response); return(response->qualifierDeclarations); }
void CIMClientRep::modifyClass( const CIMNamespaceName& nameSpace, const CIMClass& modifiedClass ) { AutoPtr<CIMRequestMessage> request(new CIMModifyClassRequestMessage( String::EMPTY, nameSpace, modifiedClass, QueueIdStack())); Message* message = _doRequest(request, CIM_MODIFY_CLASS_RESPONSE_MESSAGE); CIMModifyClassResponseMessage* response = (CIMModifyClassResponseMessage*)message; AutoPtr<CIMModifyClassResponseMessage> destroyer(response); }
void CIMClientRep::createClass( const CIMNamespaceName& nameSpace, const CIMClass& newClass ) { AutoPtr<CIMRequestMessage> request(new CIMCreateClassRequestMessage( String::EMPTY, nameSpace, newClass, QueueIdStack())); Message* message = _doRequest(request, CIM_CREATE_CLASS_RESPONSE_MESSAGE); CIMCreateClassResponseMessage* response = (CIMCreateClassResponseMessage*)message; AutoPtr<CIMCreateClassResponseMessage> destroyer(response); }
void CIMClientRep::deleteClass( const CIMNamespaceName& nameSpace, const CIMName& className ) { AutoPtr<CIMRequestMessage> request(new CIMDeleteClassRequestMessage( String::EMPTY, nameSpace, className, QueueIdStack())); Message* message = _doRequest(request, CIM_DELETE_CLASS_RESPONSE_MESSAGE); CIMDeleteClassResponseMessage* response = (CIMDeleteClassResponseMessage*)message; AutoPtr<CIMDeleteClassResponseMessage> destroyer(response); }
void CIMClientRep::deleteInstance( const CIMNamespaceName& nameSpace, const CIMObjectPath& instanceName ) { compareObjectPathtoCurrentConnection(instanceName); AutoPtr<CIMRequestMessage> request(new CIMDeleteInstanceRequestMessage( String::EMPTY, nameSpace, instanceName, QueueIdStack())); Message* message = _doRequest(request, CIM_DELETE_INSTANCE_RESPONSE_MESSAGE); CIMDeleteInstanceResponseMessage* response = (CIMDeleteInstanceResponseMessage*)message; AutoPtr<CIMDeleteInstanceResponseMessage> destroyer(response); }
bool compressRGBABigEndianToPNG(unsigned char* rgbaBigEndianData, const IntSize& size, Vector<char>& pngData) { png_struct* pngPtr = png_create_write_struct(PNG_LIBPNG_VER_STRING, (png_voidp)NULL, (png_error_ptr)NULL, (png_error_ptr)NULL); if (!pngPtr) return false; png_info* infoPtr = png_create_info_struct(pngPtr); if (!infoPtr) { png_destroy_write_struct(&pngPtr, 0); return false; } PNGWriteStructDestroyer destroyer(&pngPtr, &infoPtr); // The destroyer will ensure that the structures are cleaned up in this // case, even though we may get here as a jump from random parts of the // PNG library called below. if (setjmp(png_jmpbuf(pngPtr))) return false; // Set our callback for libpng to give us the data. PNGEncoderState state(&pngData); png_set_write_fn(pngPtr, &state, encoderWriteCallback, 0); int pngOutputColorType = PNG_COLOR_TYPE_RGB_ALPHA; png_set_IHDR(pngPtr, infoPtr, size.width(), size.height(), 8, pngOutputColorType, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); png_write_info(pngPtr, infoPtr); unsigned bytesPerRow = size.width() * 4; for (unsigned y = 0; y < size.height(); ++y) { png_write_row(pngPtr, rgbaBigEndianData); rgbaBigEndianData += bytesPerRow; } png_write_end(pngPtr, infoPtr); return true; }
Array<CIMObjectPath> CIMClientRep::enumerateInstanceNames( const CIMNamespaceName& nameSpace, const CIMName& className ) { AutoPtr<CIMRequestMessage> request(new CIMEnumerateInstanceNamesRequestMessage( String::EMPTY, nameSpace, className, QueueIdStack())); Message* message = _doRequest(request, CIM_ENUMERATE_INSTANCE_NAMES_RESPONSE_MESSAGE); CIMEnumerateInstanceNamesResponseMessage* response = (CIMEnumerateInstanceNamesResponseMessage*)message; AutoPtr<CIMEnumerateInstanceNamesResponseMessage> destroyer(response); return(response->instanceNames); }
CIMQualifierDecl CIMClientRep::getQualifier( const CIMNamespaceName& nameSpace, const CIMName& qualifierName ) { AutoPtr<CIMRequestMessage> request(new CIMGetQualifierRequestMessage( String::EMPTY, nameSpace, qualifierName, QueueIdStack())); Message* message = _doRequest(request, CIM_GET_QUALIFIER_RESPONSE_MESSAGE); CIMGetQualifierResponseMessage* response = (CIMGetQualifierResponseMessage*)message; AutoPtr<CIMGetQualifierResponseMessage> destroyer(response); return(response->cimQualifierDecl); }
CIMObjectPath CIMClientRep::createInstance( const CIMNamespaceName& nameSpace, const CIMInstance& newInstance ) { compareObjectPathtoCurrentConnection(newInstance.getPath()); AutoPtr<CIMRequestMessage> request(new CIMCreateInstanceRequestMessage( String::EMPTY, nameSpace, newInstance, QueueIdStack())); Message* message = _doRequest(request, CIM_CREATE_INSTANCE_RESPONSE_MESSAGE); CIMCreateInstanceResponseMessage* response = (CIMCreateInstanceResponseMessage*)message; AutoPtr<CIMCreateInstanceResponseMessage> destroyer(response); return(response->instanceName); }
void edjs_TreeDestroy(edjs_tree_node *root, void (*destroyer)(edjs_tree_node *)) { edjs_tree_node *parent = NULL; while (NULL != root) { if (NULL != root->left) root = root->left; else if (NULL != root->right) root = root->right; else { parent = root->parent; if (NULL != parent) { if (root == root->parent->left) root->parent->left = NULL; else root->parent->right = NULL; } destroyer(root); root = parent; } } }
Array<CIMObject> CIMClientRep::execQuery( const CIMNamespaceName& nameSpace, const String& queryLanguage, const String& query ) { AutoPtr<CIMRequestMessage> request(new CIMExecQueryRequestMessage( String::EMPTY, nameSpace, queryLanguage, query, QueueIdStack())); Message* message = _doRequest(request, CIM_EXEC_QUERY_RESPONSE_MESSAGE); CIMExecQueryResponseMessage* response = (CIMExecQueryResponseMessage*)message; AutoPtr<CIMExecQueryResponseMessage> destroyer(response); return(response->cimObjects); }
void CIMClientRep::modifyInstance( const CIMNamespaceName& nameSpace, const CIMInstance& modifiedInstance, Boolean includeQualifiers, const CIMPropertyList& propertyList ) { compareObjectPathtoCurrentConnection(modifiedInstance.getPath()); AutoPtr<CIMRequestMessage> request(new CIMModifyInstanceRequestMessage( String::EMPTY, nameSpace, modifiedInstance, includeQualifiers, propertyList, QueueIdStack())); Message* message = _doRequest(request, CIM_MODIFY_INSTANCE_RESPONSE_MESSAGE); CIMModifyInstanceResponseMessage* response = (CIMModifyInstanceResponseMessage*)message; AutoPtr<CIMModifyInstanceResponseMessage> destroyer(response); }
void CIMClientRep::setProperty( const CIMNamespaceName& nameSpace, const CIMObjectPath& instanceName, const CIMName& propertyName, const CIMValue& newValue ) { compareObjectPathtoCurrentConnection(instanceName); AutoPtr<CIMRequestMessage> request(new CIMSetPropertyRequestMessage( String::EMPTY, nameSpace, instanceName, propertyName, newValue, QueueIdStack())); Message* message = _doRequest(request, CIM_SET_PROPERTY_RESPONSE_MESSAGE); CIMSetPropertyResponseMessage* response = (CIMSetPropertyResponseMessage*)message; AutoPtr<CIMSetPropertyResponseMessage> destroyer(response); }
static bool _proc( Instance* cimple_inst, Enum_Instances_Status status, void* client_data) { Data* data = (Data*)client_data; Destroyer<Instance> destroyer(cimple_inst); if (!cimple_inst) return false; // Ignore if an error was already encountered. if (data->rc != CMPI_RC_OK) return false; // Filter out unwanted properties. filter_properties(cimple_inst, data->properties); // Convert to a CMPI instance and deliver: CMPIInstance* cmpi_inst = 0; data->rc = make_cmpi_instance( data->broker, cimple_inst, name_space(data->cmpi_op), data->cmpi_op, cmpi_inst); if (data->rc != CMPI_RC_OK) return false; CMReturnInstance(data->result, cmpi_inst); return true; }
CIMValue CIMClientRep::invokeMethod( const CIMNamespaceName& nameSpace, const CIMObjectPath& instanceName, const CIMName& methodName, const Array<CIMParamValue>& inParameters, Array<CIMParamValue>& outParameters ) { // ATTN-RK-P2-20020301: Does it make sense to have a nameSpace parameter // when the namespace should already be included in the instanceName? // ATTN-RK-P3-20020301: Do we need to make sure the caller didn't specify // a host name in the instanceName? // solved with PEP#139 Stage1 as other CIMOMs contained in the object path // will cause a TypeMisMatchException compareObjectPathtoCurrentConnection(instanceName); AutoPtr<CIMRequestMessage> request(new CIMInvokeMethodRequestMessage( String::EMPTY, nameSpace, instanceName, methodName, inParameters, QueueIdStack())); Message* message = _doRequest(request, CIM_INVOKE_METHOD_RESPONSE_MESSAGE); CIMInvokeMethodResponseMessage* response = (CIMInvokeMethodResponseMessage*)message; AutoPtr<CIMInvokeMethodResponseMessage> destroyer(response); outParameters = response->outParameters; return(response->retValue); }
void primitive_variant::destroy() { apply(destroyer()); m_ptype = pt_null; }
Buffer WbemExecClient::issueRequest(const Buffer& request) { if (!_connected) { throw NotConnectedException(); } HTTPMessage* httpRequest = new HTTPMessage(request); // Note: A historical defect in the calculation of the Content-Length // header makes it possible that wbemexec input files exist with a // Content-Length value one larger than the actual content size. Adding // and extra newline character to the end of the message keeps those old // scripts working. httpRequest->message << "\n"; _authenticator.setRequestMessage(httpRequest); Boolean haveBeenChallenged = false; HTTPMessage* httpResponse; while (1) { HTTPMessage* httpRequestCopy = new HTTPMessage(*(HTTPMessage*)_authenticator.getRequestMessage()); _addAuthHeader(httpRequestCopy); Message* response = _doRequest(httpRequestCopy); PEGASUS_ASSERT(response->getType() == HTTP_MESSAGE); httpResponse = (HTTPMessage*)response; // If we've already been challenged or if the response does not // contain a challenge, there is nothing more to do. String startLine; Array<HTTPHeader> headers; Uint32 contentLength; httpResponse->parse(startLine, headers, contentLength); if (haveBeenChallenged || !_checkNeedToResend(headers)) { break; } // If the challenge contains a Connection: Close header, reestablish // the connection. String connectionHeader; if (HTTPMessage::lookupHeader( headers, "Connection", connectionHeader, false)) { if (String::equalNoCase(connectionHeader, "Close")) { _reconnect(); } } // Prompt for a password, if necessary if ((_password == String::EMPTY) && _isRemote) { _password = _promptForPassword(); _authenticator.setPassword(_password); } haveBeenChallenged = true; delete httpResponse; } AutoPtr<HTTPMessage> origRequest( (HTTPMessage*)_authenticator.releaseRequestMessage()); AutoPtr<HTTPMessage> destroyer(httpResponse); return httpResponse->message; }