private void AddCarlaServerDependency(ReadOnlyTargetRules Target) { string LibCarlaInstallPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "../../CarlaDependencies")); ADelegate GetLibName = (string BaseName) => { if (IsWindows(Target)) { return(BaseName + ".lib"); } else { return("lib" + BaseName + ".a"); } }; // Link dependencies. if (IsWindows(Target)) { AddBoostLibs(Path.Combine(LibCarlaInstallPath, "lib")); PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("rpc"))); PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("import_clingo"))); if (UseDebugLibs(Target)) { PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server_debug"))); } else { PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server"))); } } else { PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("rpc"))); PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", "libclingo.so")); if (UseDebugLibs(Target)) { PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server_debug"))); } else { PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server"))); } } // Include path. string LibCarlaIncludePath = Path.Combine(LibCarlaInstallPath, "include"); PublicIncludePaths.Add(LibCarlaIncludePath); PrivateIncludePaths.Add(LibCarlaIncludePath); string LibClingoIncludePath = Path.Combine(LibCarlaIncludePath, "clingo"); PrivateIncludePaths.Add(LibClingoIncludePath); PublicDefinitions.Add("ASIO_NO_EXCEPTIONS"); PublicDefinitions.Add("BOOST_NO_EXCEPTIONS"); PublicDefinitions.Add("LIBCARLA_NO_EXCEPTIONS"); PublicDefinitions.Add("PUGIXML_NO_EXCEPTIONS"); }
public void TheThrowPart() { ADelegate handler = new ADelegate(ThrowException); handler += new ADelegate(ThrowException); List <Exception> exceptions = null; foreach (var d in handler.GetInvocationList()) { try { // DoSomething…. } catch (Exception exc) { if (exceptions == null) { exceptions = new List <Exception> (); } exceptions.Add(exc); } } if (exceptions != null) { throw new AggregateException(exceptions); } }
static void Main(string[] args) { ADelegate del = AMethod; del += BMethod; //ADelegate del = new ADelegate( AMethod ); //del += new ADelegate( BMethod ); }
/// <summary> /// A test constructor /// </summary> /// <param name="x">An int</param> public TestClass(int x) { AnEvent += new ADelegate(AnEventHandler); aField = true; aField1 = true; aField2 = true; aField3 = true; aField4 = true; }
private void AddCarlaServerDependency(ReadOnlyTargetRules Target) { string LibCarlaInstallPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "../../CarlaDependencies")); ADelegate GetLibName = (string BaseName) => { if (IsWindows(Target)) { return(BaseName + ".lib"); } else { return("lib" + BaseName + ".a"); } }; // Link dependencies. if (IsWindows(Target)) { AddBoostLibs(Path.Combine(LibCarlaInstallPath, "lib")); PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("rpc"))); if (UseDebugLibs(Target)) { PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server_debug"))); } else { PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server"))); } } else { PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("c++abi"))); PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("rpc"))); if (UseDebugLibs(Target)) { PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server_debug"))); } else { PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server"))); } } // Include path. string LibCarlaIncludePath = Path.Combine(LibCarlaInstallPath, "include"); PublicIncludePaths.Add(LibCarlaIncludePath); PrivateIncludePaths.Add(LibCarlaIncludePath); /// @todo This is necessary because rpclib uses exceptions to notify errors. bEnableExceptions = true; }
private void AddCarlaServerDependency(ReadOnlyTargetRules Target) { string CarlaServerInstallPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "../../CarlaServer")); string CarlaServerLib; if (UseDebugLibs(Target)) { CarlaServerLib = "carlaserverd"; } else { CarlaServerLib = "carlaserver"; } ADelegate GetLibName = (string BaseName) => { if (IsWindows(Target)) { return(BaseName + ".lib"); } else { return("lib" + BaseName + ".a"); } }; // Link dependencies. if (IsWindows(Target)) { // Auto-links boost libraries in folder. PublicLibraryPaths.Add(Path.Combine(CarlaServerInstallPath, "lib")); PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetLibName("libprotobuf"))); PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetLibName(CarlaServerLib))); } else { PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetLibName("c++abi"))); PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetLibName("boost_system"))); PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetLibName("protobuf"))); PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetLibName(CarlaServerLib))); } // Include path. string CarlaServerIncludePath = Path.Combine(CarlaServerInstallPath, "include"); PublicIncludePaths.Add(CarlaServerIncludePath); PrivateIncludePaths.Add(CarlaServerIncludePath); }
public void TheThrowPart () { ADelegate handler = new ADelegate (ThrowException); handler += new ADelegate (ThrowException); List<Exception> exceptions = null; foreach (var d in handler.GetInvocationList()) { try { // DoSomething…. } catch (Exception exc) { if (exceptions == null) exceptions = new List<Exception> (); exceptions.Add (exc); } } if (exceptions != null) throw new AggregateException (exceptions); }
public DelegatesEventsObject(int id, ADelegate someDelegate) { _id = id; OnEvent = someDelegate; }
private void AddCarlaServerDependency(ReadOnlyTargetRules Target) { string LibCarlaInstallPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "../../CarlaDependencies")); ADelegate GetLibName = (string BaseName) => { if (IsWindows(Target)) { return(BaseName + ".lib"); } else { return("lib" + BaseName + ".a"); } }; // Link dependencies. if (IsWindows(Target)) { AddBoostLibs(Path.Combine(LibCarlaInstallPath, "lib")); PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("rpc"))); if (UseDebugLibs(Target)) { PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server_debug"))); } else { PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server"))); } if (UsingChrono) { PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("ChronoEngine"))); PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("ChronoEngine_vehicle"))); PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("ChronoModels_vehicle"))); PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("ChronoModels_robot"))); AddDllDependency(Path.Combine(LibCarlaInstallPath, "dll"), "ChronoEngine.dll"); AddDllDependency(Path.Combine(LibCarlaInstallPath, "dll"), "ChronoEngine_vehicle.dll"); AddDllDependency(Path.Combine(LibCarlaInstallPath, "dll"), "ChronoModels_vehicle.dll"); AddDllDependency(Path.Combine(LibCarlaInstallPath, "dll"), "ChronoModels_robot.dll"); bUseRTTI = true; } } else { PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("rpc"))); if (UseDebugLibs(Target)) { PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server_debug"))); } else { PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server"))); } if (UsingChrono) { RuntimeDependencies.Add(Path.Combine(LibCarlaInstallPath, "lib", "libc++.so")); RuntimeDependencies.Add(Path.Combine(LibCarlaInstallPath, "lib", "libc++.so.1")); RuntimeDependencies.Add(Path.Combine(LibCarlaInstallPath, "lib", "libc++.so.1.0")); RuntimeDependencies.Add(Path.Combine(LibCarlaInstallPath, "lib", "libc++abi.so")); RuntimeDependencies.Add(Path.Combine(LibCarlaInstallPath, "lib", "libc++abi.so.1")); RuntimeDependencies.Add(Path.Combine(LibCarlaInstallPath, "lib", "libc++abi.so.1.0")); AddDynamicLibrary(Path.Combine(LibCarlaInstallPath, "lib", "libChronoEngine.so")); AddDynamicLibrary(Path.Combine(LibCarlaInstallPath, "lib", "libChronoEngine_vehicle.so")); AddDynamicLibrary(Path.Combine(LibCarlaInstallPath, "lib", "libChronoModels_vehicle.so")); AddDynamicLibrary(Path.Combine(LibCarlaInstallPath, "lib", "libChronoModels_robot.so")); bUseRTTI = true; bEnableExceptions = true; } } // Include path. string LibCarlaIncludePath = Path.Combine(LibCarlaInstallPath, "include"); PublicIncludePaths.Add(LibCarlaIncludePath); PrivateIncludePaths.Add(LibCarlaIncludePath); PublicDefinitions.Add("ASIO_NO_EXCEPTIONS"); PublicDefinitions.Add("BOOST_NO_EXCEPTIONS"); PublicDefinitions.Add("LIBCARLA_NO_EXCEPTIONS"); PublicDefinitions.Add("PUGIXML_NO_EXCEPTIONS"); PublicDefinitions.Add("BOOST_DISABLE_ABI_HEADERS"); PublicDefinitions.Add("BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY"); }