Metodo IDataModelManager::GetModelForType (dbgmodel.h)
Il metodo GetModelForType restituisce il modello di dati che è il visualizzatore canonico per una determinata istanza del tipo. In effetti, questo metodo trova la firma del tipo corrispondente migliore registrata con una chiamata precedente al metodo RegisterModelForTypeSignature e restituisce il modello di dati associato.
Sintassi
HRESULT GetModelForType(
IDebugHostType *type,
IModelObject **dataModel,
IDebugHostTypeSignature **typeSignature,
IDebugHostSymbolEnumerator **wildcardMatches
);
Parametri
type
Istanza del tipo concreto per cui trovare il visualizzatore canonico più adatto registrato tramite una chiamata precedente al metodo RegisterModelForTypeSignature.
dataModel
Il modello di dati che è il visualizzatore canonico per l'istanza di tipo specificata, come determinato dalla firma del tipo corrispondente migliore registrata tramite una chiamata precedente a RegisterModelForTypeSignature, verrà restituita qui. Questo modello di dati verrà collegato automaticamente a qualsiasi oggetto nativo/linguaggio creato con il tipo specificato dall'argomento tipo.
typeSignature
La firma del tipo la cui corrispondenza con il tipo ha causato la restituzione del modello di dati registrato da una chiamata precedente a RegisterModelForTypeSignature con la firma del tipo restituito.
wildcardMatches
Se nella firma sono presenti caratteri jolly restituiti nell'argomento typeSignature, qui viene restituito un enumeratore di tutte le corrispondenze tra i caratteri jolly e l'istanza di tipo concreto specificata nell'argomento type.
Valore restituito
Questo metodo restituisce HRESULT che indica l'esito positivo o negativo.
Osservazioni
codice di esempio
ComPtr<IDataModelManager> spManager; /* get the data model manager */
ComPtr<IDebugHostModule> spModule; /* get a module */
// Find the type of "MyType<int>" within the module
ComPtr<IDebugHostType> spType;
if (SUCCEEDED(spModule->FindTypeByName(L"MyType<int>", &spType)))
{
// Find the canonical visualizer which would be applied to MyType<int>
ComPtr<IModelObject> spDataModel;
ComPtr<IDebugHostTypeSignature> spSignature;
ComPtr<IDebugHostSymbolEnumerator> spWildcardMatches;
if (SUCCEEDED(spManager->GetModelForType(spType.Get(),
&spDataModel,
&spSignature,
&spWildcardMatches)))
{
// There is a visualizer which matched.
// spDataModel is the data model object which was registered as
// the canonical visualizer (RegisterModelForTypeSignature)
// spSignature is the signature which that data model was registered
// against (e.g.: created for MyType<*> via
// CreateTypeSignature/RegisterModelForTypeSignature)
// spWildcardMatches is an enumerator of the wildcard matches between
// the specific type spType and the signature spSignature (here
// int matched *, so there will be one item -- the type 'int' in
// the enumerator)
}
Fabbisogno
Requisito | Valore |
---|---|
intestazione | dbgmodel.h |