/// <summary> Converts an unordered point cloud from a .ply file to VDB format. </summary> /// <param name="filename">The absolute path to the .ply file. </param> /// <param name="outfile">The absolute path to the .vdb file. </param> /// <param name="cb">The optional <see cref="LoggingCallback">callback</see> for logging native messages.</param> /// <returns>True if the file was successfully converted, false if not. </returns> /// <remarks>Currently only supports vertex positions (float) and colors (uint8) </remarks> public static bool ConvertPLYToVDB(string filename, string outfile, LoggingCallback cb = null) { LoggingCallback logger = cb == null ? LogMessage : cb; openvdbInitialize(); return(convertPLYToVDB(filename, outfile, logger)); }
public void testCallback() { Configuration conf = new Configuration(); MemoryManager mgr = new MemoryManager(configuredPoolSize); long pool = mgr.getTotalMemoryPool(); LoggingCallback[] calls = new LoggingCallback[20]; for (int i = 0; i < calls.Length; ++i) { calls[i] = new LoggingCallback(); mgr.addWriter(i.ToString(), pool / 4, calls[i]); } // add enough rows to get the memory manager to check the limits for (int i = 0; i < 10000; ++i) { mgr.addedRow(1); } for (int call = 0; call < calls.Length; ++call) { Assert.Equal(2, calls[call].LogLength); foreach (double argument in calls[call].Log) { Assert.Equal(0.2, argument, ERROR); } } }
static int Main(string[] args) { try { // set up a simple configuration that logs on the console. log4net.Config.XmlConfigurator.Configure(); // command line parsing Options options = new Options(); if (!CommandLine.Parser.Default.ParseArguments(args, options)) { Console.WriteLine(options.GetUsage()); return(-1); } string dbPath = options.InputFile; _log.Info(string.Format("db path = {0}", dbPath)); LegacyDBUploder uploader = new treeDiM.PLMPackLib.LegacyDBUploder(); LoggingCallback callback = new LoggingCallback(); uploader.DatabasePath = dbPath; uploader.UserName = options.UserName; uploader.Password = options.Password; uploader.ActuallyUpload = !options.Test; uploader.Upload(callback); } catch (Exception ex) { _log.Error(ex.ToString()); return(-1); } return(0); }
internal static extern bool Configure( bool hasSignallingThread, bool hasWorkerThread, bool forceSoftwareVideoEncoder, bool autoShutdown, bool useFakeEncoders, bool useFakeDecoders, bool logToStdErr, bool logToDebug, LoggingCallback loggingCallback, int minimumLoggingSeverity);
internal HookContext(HookClosure <ReturnType> closure, HookOperation <ReturnType> operation, ErrorHandler <ReturnType> errorHandler, LoggingCallback logging, string format, params object[] args) { closure_ = closure; operation_ = operation; errorHandler_ = errorHandler; logging_ = logging; format_ = format; args_ = args; }
/// <summary> /// Register the logger. /// </summary> public static void RegisterLogger() { // Register the logger if we have not already if (loggingCallback == null) { // Keep the callback as a member to prevent it from being garbage collected. loggingCallback = LoggingHandler; errorCallback = ErrorHandler; hbFunctions.hb_register_logger(loggingCallback); hbFunctions.hb_register_error_handler(errorCallback); } }
private void Log(string text) { if (this.txtLog.InvokeRequired) { LoggingCallback d = new LoggingCallback(Log); this.Invoke(d, new object[] { text }); } else { this.txtLog.Text = text; } }
/// <summary> Loads a PointDataGrid from <see cref="FilePath" />.</summary> /// <param name="gridName">The name of the grid to load.</param> /// <param name="cb">The optional <see cref="LoggingCallback">callback</see> for logging native messages.</param> /// <remarks> <see cref="FilePath"/> must be set in order to load the grid.</remarks> /// <exception cref="Exception">The file is not found, or <see cref="FilePath"/> is not set.</exception> public void Load(string name = null, LoggingCallback cb = null) { if (string.IsNullOrEmpty(FilePath)) { throw new Exception("FilePath must be set in order to load a PointDataGrid"); } if (!File.Exists(FilePath)) { throw new FileNotFoundException(string.Format("{0} could not be found!", FilePath)); } string grid = name == null ? gridName : name; LoggingCallback logger = cb == null ? LogMessage : cb; gridRef = readPointGridFromFile(FilePath, grid, logger); }
private void Initialize(LoggingCallback callback, String userData) { if (userData == null) { userData = String.Empty; } m_assimpCallback = OnAiLogStreamCallback; m_logCallback = callback; m_userData = userData; AiLogStream logStream; logStream.Callback = Marshal.GetFunctionPointerForDelegate(m_assimpCallback); logStream.UserData = IntPtr.Zero; m_logstreamPtr = MemoryHelper.AllocateMemory(MemoryHelper.SizeOf <AiLogStream>()); Marshal.StructureToPtr(logStream, m_logstreamPtr, false); }
/// <summary> /// Register the logger. /// </summary> public static void RegisterLogger() { // Register the logger if we have not already if (loggingCallback == null) { // Keep the callback as a member to prevent it from being garbage collected. loggingCallback = new LoggingCallback(LoggingHandler); errorCallback = new LoggingCallback(ErrorHandler); HBFunctions.hb_register_logger(loggingCallback); HBFunctions.hb_register_error_handler(errorCallback); } }
/// <summary> /// Constructs a new LogStream. /// </summary> /// <param name="callback">Logging callback that is called when messages are received by the log stream.</param> public LogStream(LoggingCallback callback) { Initialize(callback, String.Empty); }
// (void (*cb)(const char *line, void *argp), void* argp private static extern int quiche_enable_debug_logging(LoggingCallback cb, IntPtr argp);
public static extern void set_logging_callback([MarshalAs(UnmanagedType.FunctionPtr)] LoggingCallback logging_callback, IntPtr user_data);
public static extern void hb_register_logger(LoggingCallback callback);
public static extern void hb_register_error_handler(LoggingCallback callback);
public void hb_register_logger(LoggingCallback callback) { HBFunctions.hb_register_logger(callback); }
public static int QuicheEnableDebugLogging(LoggingCallback cb, IntPtr argp) { return(quiche_enable_debug_logging(cb, argp)); }
private static extern IntPtr readPointGridFromFile(string filename, string gridName, LoggingCallback cb);
/// <summary> /// Constructs a new LogStream. /// </summary> /// <param name="callback">Logging callback that is called when messages are received by the log stream.</param> /// <param name="userData">User-supplied data</param> public LogStream(LoggingCallback callback, String userData) { Initialize(callback, userData); }
public void hb_register_error_handler(LoggingCallback callback) { HBFunctions.hb_register_error_handler(callback); }
private static extern bool convertPLYToVDB(string filename, string outfile, LoggingCallback callback);
private void Initialize(LoggingCallback callback, String userData) { if(userData == null) userData = String.Empty; m_assimpCallback = OnAiLogStreamCallback; m_logCallback = callback; m_userData = userData; AiLogStream logStream; logStream.Callback = Marshal.GetFunctionPointerForDelegate(m_assimpCallback); logStream.UserData = IntPtr.Zero; m_logstreamPtr = MemoryHelper.AllocateMemory(MemoryHelper.SizeOf<AiLogStream>()); Marshal.StructureToPtr(logStream, m_logstreamPtr, false); }