Click or drag to resize


Adds one or more physical names to a repeated capability.

static ViStatus AddPhysicalNames(ViSession Vi, const std::string& strSelector);

[in] ViSession handle for the driver session.


[in] A repeated capability selector which can include virtual names, physical names, comma-separated lists of names and physical name ranges.

Return Value

Returns a VI_SUCCESS if the operation was successful or a failure ViStatus otherwise.


The AddPhysicalNames function is used to add physical names to a repeated capability. This can be useful for drivers that support dynamic repeated capabilities -- that is, repeated capabilities where the exact number of repeated capabilities is not know upfront. The driver can query the instrument to determine which physical names are present in the device and the driver can use the AddPhysicalNames function to add those names.

The strSelector parameter can include lists and ranges of physical names and is parsed and expanded according the the IVI-defined rules for repeated capability selectors, as presented in "IVI 3.1 Section 4.4.7 Formal Syntax for Repeated Capability Selectors".

Selectors have a general form such as the following:



The following example demonstrates how a developer might query the instrument for physical names during the initialization sequence and use the results to populate a repeated capability using the AddPhysicalNames function.

ViStatus _VI_FUNC acme4321_InitWithOptions(ViRsrc ResourceName, ViBoolean IdQuery, ViBoolean Reset, ViConstString OptionsString, ViSession* Vi)
   auto status = VI_SUCCESS;

   status = nrt::InitWithOptions<Acme4321DriverSession>(ResourceName, IdQuery, Reset, OptionsString, Vi);

   if (Reset)
       status = acme_reset(*Vi);


   // Query the instrument for the number of channels
   long cChannels;
   status = viQueryf(GetVisaSession(Vi), "SYST:CTYP:COUN?\n", "%lg%*t", &cChannels);

   // Note that the AddPhysicalNames function accepts selectors, so it can include ranges and comma-separated lists of 
   // physical names.  Each channel name is of the form "CH[channel]".  We'll add all of the channels in one go by building
   // a selector that includes a range from 1 to the cChannels we queried from the device.
   auto strSelector = "CH1-CH" + std::to_string(cChannels);
   status = Channel::AddPhysicalNames(Vi, strSelector);

   return status;

Download a complete CHM version of this documentation here.