/// <summary>
 /// Gets functions objects connected in socked named <c>socketName</c>.
 /// Iff <c>oneAtMinimum</c> is true and there is no functions object 
 /// connected in the socket than <see cref="T:Ferda.Modules.NoConnectionInSocketError"/>
 /// is thrown.
 /// </summary>
 /// <example>
 /// Please see an example for <see cref="M:Ferda.Modules.Boxes.SocketConnections.GetObjectPrx(Ferda.Modules.BoxModuleI,System.String)"/>.
 /// </example>
 /// <param name="boxModule">Box Module (having socket named <c>socketName</c>).</param>
 /// <param name="socketName">Name of socket.</param>
 /// <param name="oneAtMinimum">Iff this is true and there is no 
 /// functions object connected in socket than
 /// <see cref="T:Ferda.Modules.NoConnectionInSocketError"/> is thrown.</param>
 /// <returns>Array of <see cref="T:Ice.ObjectPrx">proxies</see> of functions objects 
 /// connected in <c>socketName</c>.</returns>
 /// <exception cref="T:Ferda.Modules.NoConnectionInSocketError">
 /// Thrown iff there is no BoxModule connected in <c>socketName</c> 
 /// and <c>oneAtMinimum</c> is true.
 /// </exception>
 public static Ice.ObjectPrx[] GetObjectPrxs(BoxModuleI boxModule, string socketName, bool oneAtMinimum)
 {
     Ice.ObjectPrx[] functions = boxModule.GetFunctions(socketName);
     if (oneAtMinimum && functions.Length == 0)
     {
         throw Ferda.Modules.Exceptions.NoConnectionInSocketError(null, boxModule.StringIceIdentity, "BoxInf14: There is no connection in the socket! (" + socketName + ")", new string[] { socketName });
     }
     return functions;
 }
 /// <summary>
 /// Similar to <see cref="M:Ferda.Modules.Boxes.SocketConnections.GetObjectPrx(Ferda.Modules.BoxModuleI,System.String)"/>
 /// </summary>
 /// <param name="boxModule">Box Module (having socket named <c>socketName</c>).</param>
 /// <param name="socketName">Name of socket.</param>
 /// <param name="objectPrx"><see cref="T:Ice.ObjectPrx"/> i.e. proxy of functions connected in <c>socketName</c>.</param>
 /// <returns>True is returned iff there is just one functions object connected 
 /// in the socket. If true is returned than proxy of the functions object is given
 /// in out parameter <c>objectPrx</c>.</returns>
 /// <exception cref="T:System.Exception">Thrown iff there 
 /// is connected more than one BoxModule in <c>socketName</c>.
 /// </exception>
 public static bool TryGetObjectPrx(BoxModuleI boxModule, string socketName, out Ice.ObjectPrx objectPrx)
 {
     Ice.ObjectPrx[] functions = boxModule.GetFunctions(socketName);
     if (functions.Length == 0)
     {
         objectPrx = null;
         return false;
     }
     else if (functions.Length == 1)
     {
         foreach (Ice.ObjectPrx prx in functions)
         {
             objectPrx = prx;
             return true;
         }
     }
     string message = "BoxInf13: There should be connected one box at maximum! in socket: \"" + socketName + "\".";
     System.Diagnostics.Debug.WriteLine(message);
     throw new Exception(message);
 }
 /// <summary>
 /// Iff there is exactly one functions object connected in socket 
 /// named <c>socketName</c> than this object is returned. Iff
 /// there is no functions object connected in the socket than
 /// <see cref="T:Ferda.Modules.NoConnectionInSocketError"/> is thrown.
 /// Otherwise (i.e. there is more than one functions object in the socket)
 /// <see cref="T:System.Exception"/> is thrown.
 /// </summary>
 /// <example>
 /// <para>This examples show basic usage of this function.</para>
 /// <para>This is an example of slice design. Apparently MyBoxModule 
 /// has one interface for implementation MyBoxModuleFunctions.</para>
 /// <code>
 /// module MyBoxModule
 /// {
 /// 	interface MyBoxModuleFunctions
 /// 	{
 /// 		 /* ... */
 /// 	};
 /// };
 /// </code>
 /// <para>This is a sample C# class implementing MyBoxModuleFunctions interface.</para>
 /// <code>
 /// namespace MyBoxModule
 /// {
 ///		class MyBoxModuleFunctionsI : MyBoxModuleFunctionsDisp_, IFunctions
 ///		{
 ///			/* ... */
 ///		}
 /// }
 /// </code>
 /// <para>Herein "MyBoxModuleFunctions" are accepted by socket named "MySocket".</para>
 /// <code>
 /// namespace MyNextBoxModule
 /// {
 ///		class MyNextBoxModuleFunctionsI :  : MyNextBoxModuleFunctionsDisp_, IFunctions
 ///		{
 ///			protected BoxModuleI boxModule;
 /// 		
 ///			//all functions has to implement this interface
 ///			#region IFunctions Members
 /// 		public void setBoxModuleInfo(BoxModuleI boxModule, IBoxInfo boxInfo)
 /// 		{
 /// 			this.boxModule = boxModule;
 /// 		}
 /// 		#endregion
 /// 
 ///			/* ... */
 /// 
 ///			protected MyBoxModuleFunctionsPrx getMyBoxModuleFunctionsPrx()
 ///			{
 ///				//gets proxy of functions in socket named "MySocket"
 ///				Ice.ObjectPrx functionsPrx = 
 ///					Ferda.Modules.Boxes.SocketConnections.GetObjectPrx(this.boxModule, "MySocket");
 /// 
 ///				//this makes checked casting from Ice.ObjectPrx to MyBoxModuleFunctionsPrx
 ///				return MyBoxModuleFunctionsPrxHelper.checkedCast(functionsPrx);
 ///			)
 ///		}
 /// }
 /// </code>
 /// </example>
 /// <param name="boxModule">Box Module (having socket named <c>socketName</c>).</param>
 /// <param name="socketName">Name of socket.</param>
 /// <returns><see cref="T:Ice.ObjectPrx"/> i.e. proxy of functions connected in <c>socketName</c>.</returns>
 /// <exception cref="T:System.Exception">Thrown iff there 
 /// is connected more than one BoxModule in <c>socketName</c>.
 /// </exception>
 /// <exception cref="T:Ferda.Modules.NoConnectionInSocketError">
 /// Thrown iff there is no BoxModule connected in <c>socketName</c>.
 /// </exception>
 public static Ice.ObjectPrx GetObjectPrx(BoxModuleI boxModule, string socketName)
 {
     Ice.ObjectPrx[] functions = boxModule.GetFunctions(socketName);
     if (functions.Length == 0)
     {
         throw Ferda.Modules.Exceptions.NoConnectionInSocketError(null, boxModule.StringIceIdentity, "BoxInf11: There is no connection in the socket! (" + socketName + ")", new string[] { socketName });
     }
     else if (functions.Length == 1)
     {
         foreach (Ice.ObjectPrx prx in functions)
         {
             return prx;
         }
     }
     string message = "BoxInf12: There should be connected one box at maximum! in socket: \"" + socketName + "\".";
     System.Diagnostics.Debug.WriteLine(message);
     throw new Exception(message);
 }