Class PVPool


  • public class PVPool
    extends Object
    Pool of PVs

    Allows creating PVs for all known PVFactory services.

    Maintains PVs, with a reference count.

    A PV is referred to by different names:

    • The name provided by the user: "fred" or "ca://fred", with or without prefix. May also contain parameters: "loc://x(3.14)" or "loc://x(14)".
    • Name used by the type-dependent implementation: "fred"

    The PV and the pool use the name provided by the user, because that way PV.getName() will always return the expected name. On the downside, this could create the same underlying PV twice, with and without the prefix.

    Note also that "loc://x(3.14)" and "loc://x(14)" will be treated as different PVs.

    Author:
    Kay Kasemir
    • Field Detail

      • SEPARATOR

        public static final String SEPARATOR
        Separator between PV type indicator and rest of PV name.

        This one is URL-like, and works OK with EPICS PVs because those are unlikely to contain "://" themselves, while just ":" for example is likely to be inside the PV name

        See Also:
        Constant Field Values
      • default_type

        public static String default_type
        Default PV name type prefix
    • Method Detail

      • getNameVariants

        public static Set<String> getNameVariants​(String name,
                                                  String[] equivalent_pv_prefixes)
        Parameters:
        name - PV Name, may be "xxx" or "type://xxx"
        equivalent_pv_prefixes - List of equivalent PV prefixes (types), e.g. "ca", "pva"
        Returns:
        Set of equivalent names, e.g. "xxx", "ca://xxx", "pva://xxx"
      • getSupportedPrefixes

        public static Collection<String> getSupportedPrefixes()
        Returns:
        Supported PV type prefixes
      • getPV

        public static PV getPV​(String name)
                        throws Exception
        Obtain a PV

        Obtains existing PV of that name from pool, or creates new PV if no existing PV found.

        Parameters:
        name - PV name, where prefix might be used to determine the type
        Returns:
        PV
        Throws:
        Exception - on error
        See Also:
        releasePV(PV)
      • releasePV

        public static void releasePV​(PV pv)
        Parameters:
        pv - PV to be released