Exemple #1
0
 public PipelineEvent(string id, string sender, string eventName, IListContract <string> eventArgs)
 {
     Id        = id;
     Sender    = sender;
     EventName = eventName;
     EventArgs = eventArgs;
 }
 // <Snippet3>
 public virtual void ProcessBooks(IListContract <Library.IBookInfoContract> books)
 {
     _view.ProcessBooks(CollectionAdapters.ToIList <Library.IBookInfoContract,
                                                    LibraryContractsBase.BookInfo>(books,
                                                                                   LibraryContractsAddInAdapters.BookInfoAddInAdapter.ContractToViewAdapter,
                                                                                   LibraryContractsAddInAdapters.BookInfoAddInAdapter.ViewToContractAdapter));
 }
 public PipelineMessage(string id, string content, string source, IListContract <string> targets)
 {
     Id      = id;
     Content = content;
     Source  = source;
     Targets = targets;
 }
Exemple #4
0
 public IListContract <IParamType> Invoke(string roleName, string opName, IListContract <IParamType> parameters, IPort p, ICapability reqCap, ICapability respCap)
 {
     return(CollectionAdapters.ToIListContract <VParamType, IParamType>(_view.Invoke(roleName, opName,
                                                                                     CollectionAdapters.ToIList <IParamType, VParamType>(parameters, BaseTypeAdapter.C2V, BaseTypeAdapter.V2C),
                                                                                     PortAdapter.C2V(p),
                                                                                     CapabilityAdapter.C2V(reqCap),
                                                                                     CapabilityAdapter.C2V(respCap)),
                                                                        BaseTypeAdapter.V2C, BaseTypeAdapter.C2V));
 }
 public IListContract<IParamType> Invoke(string roleName, string opName, IListContract<IParamType> parameters, IPort p, ICapability reqCap, ICapability respCap)
 {
     return CollectionAdapters.ToIListContract<VParamType, IParamType>(_view.Invoke(roleName, opName, 
                                                                                                CollectionAdapters.ToIList<IParamType, VParamType>(parameters, BaseTypeAdapter.C2V, BaseTypeAdapter.V2C),
                                                                                                PortAdapter.C2V(p), 
                                                                                                CapabilityAdapter.C2V(reqCap), 
                                                                                                CapabilityAdapter.C2V(respCap)),
                                                                                    BaseTypeAdapter.V2C, BaseTypeAdapter.C2V);
 }
        public static IList <T> ToIList <T>(IListContract <T> collection)
        {
            if (collection == null)
            {
                return(null);
            }
            Converter <T, T> c = new Converter <T, T>(IdentityConverter <T>);

            return(ToIList(collection, c, c));
        }
 // Create an IList that wraps a IContractList.  The returned IList will
 // have a lifetimeToken for the remote IContractList.  Its finalizer
 // will revoke the lifetimeToken.
 public static IList <TView> ToIList <TContract, TView>(
     IListContract <TContract> collection,
     Converter <TContract, TView> contractViewAdapter,
     Converter <TView, TContract> viewContractAdapter)
 {
     if (collection == null)
     {
         return(null);
     }
     return(new ContractListAdapter <TContract, TView>(collection, contractViewAdapter, viewContractAdapter));
 }
Exemple #8
0
        public ContractListAdapter(IListContract <T> source, Converter <T, U> wrapper, Converter <U, T> unwrapper)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (wrapper == null)
            {
                throw new ArgumentNullException("wrapper");
            }
            if (unwrapper == null)
            {
                throw new ArgumentNullException("unwrapper");
            }
            System.Diagnostics.Contracts.Contract.EndContractBlock();

            m_listContract = source;
            m_wrapper      = wrapper;
            m_unwrapper    = unwrapper;

            m_contractHandle = new ContractHandle(m_listContract);
        }
Exemple #9
0
 public void SetRoles(IPortInfo portInfo, IListContract <IRole> roles, IModule module)
 {
     _view.SetRoles(PortInfoAdapter.C2V(portInfo),
                    CollectionAdapters.ToIList <IRole, VRole>(roles, RoleAdapter.C2V, RoleAdapter.V2C),
                    ModuleAdapter.C2V(module));
 }
Exemple #10
0
 public void AsyncReturn(string roleName, string opName, IListContract<IParamType> retVals, IPort p, ICapability respCap)
 {
     _view.AsyncReturn(roleName, opName,
                       CollectionAdapters.ToIList<IParamType, VParamType>(retVals, BaseTypeAdapter.C2V, BaseTypeAdapter.V2C),
                       PortAdapter.C2V(p), CapabilityAdapter.C2V(respCap));
 }
Exemple #11
0
 public void AsyncReturn(string roleName, string opName, IListContract <IParamType> retVals, IPort p, ICapability respCap)
 {
     _view.AsyncReturn(roleName, opName,
                       CollectionAdapters.ToIList <IParamType, VParamType>(retVals, BaseTypeAdapter.C2V, BaseTypeAdapter.V2C),
                       PortAdapter.C2V(p), CapabilityAdapter.C2V(respCap));
 }
Exemple #12
0
 public virtual void ProcessBooks(IListContract <IBookInfoContract> books)
 {
     _view.ProcessBooks(CollectionAdapters.ToIList(books,
                                                   BookInfoAddInAdapter.ContractToViewAdapter,
                                                   BookInfoAddInAdapter.ViewToContractAdapter));
 }
 public void SetRoles(IPortInfo portInfo, IListContract<IRole> roles, IModule module)
 {
     _view.SetRoles(PortInfoAdapter.C2V(portInfo),
                                        CollectionAdapters.ToIList<IRole, VRole>(roles, RoleAdapter.C2V, RoleAdapter.V2C),
                                        ModuleAdapter.C2V(module));
 }